Alipay provides a demo file too much, the call is not very convenient, so the merger of Alipay payment request, check the notification, pay back the operation to a class, you can do in any ASP project reference. Because functions are inside the class, there is no problem with function name collisions. In addition, this class has realized the mobile phone, the PC automatic judgment, respectively calls corresponding interface.
Class Alipayclass
Private Partnerid
Private Partnerkey
Private Partneruser
Private Pgcharset
Private Signtype
Private Paygatway
Private payverify
Public Notifyurl
Public Callbackurl
Public ActionName
Private Bits_to_a_byte
Private Bytes_to_a_word
Private Bits_to_a_word
Public Sub Class_Initialize ()
Partnerid = "pid (partner number)"
Partnerkey = "key (Payment secret key)"
Partneruser = "Alipay account, XX@XX.com"
Paygatway = "Https://mapi.alipay.com/gateway.do?"
payverify = "https://mapi.alipay.com/gateway.do?service=notify_verify&"
' single page mode, the action in the URL, Ali returns the result without this parameter (ACTION=XXX)
' Because the action parameter does not participate in the signature, it causes sign to not be able to
'? Action=pay pay
'? Action=check Check Payment
ActionName = "Action"
Signtype = "MD5"
Pgcharset = "GBK"
Notifyurl = ""
Callbackurl = ""
Call Md5initial ()
End Sub
Public Sub Class_Terminate ()
End Sub
Public Function Pay (ByVal out_trade_no, ByVal Subject, ByVal Body, ByVal Total_fee)
If Notifyurl = "" or Callbackurl = "" Then
Currenturl = "http://" & Request.ServerVariables ("SERVER_NAME")
If Request.ServerVariables ("Server_port") <> then Currenturl = Currenturl & ":" & request.servervariable S ("Server_port")
If Notifyurl = "" Then Notifyurl = Currenturl & "/order/notify.asp"
If Callbackurl = "" Then Callbackurl = Currenturl & Request.ServerVariables ("Script_name") & "?" & ActionName & "=callback"
End If
If left (total_fee, 1) = "." Then Total_fee = "0" & Total_fee
Show_url = Request.ServerVariables ("http_referer") ' Product link, which is the previous link to this page
' Payment type
Payment_type = "1"
useragent = LCase (Request.ServerVariables ("Http_user_agent"))
If InStr (UserAgent, "Android") > 0 or InStr (useragent, "iphone") > 0 Then ' automatically identify the phone or PC
ServiceName = "Alipay.wap.create.direct.pay.by.user" ' mobile payment
Else
ServiceName = "Create_direct_pay_by_user" ' PC pay
End If
Sparatemp = Array ("service=" & ServiceName, "partner=" & Partnerid, "_input_charset=" & Pgcharset, "Payment_ Type= "& Payment_type," Notify_url= "& Notifyurl," Return_url= "& Callbackurl," out_trade_no= "& Out_trad E_no, "subject=" & Subject, "Total_fee=" & Total_fee, "body=" & Body, "seller_email=" & Partneruser, "sell Er_id= "& Partnerid," Show_url= "& Show_url)
Pay = Buildrequestform (sparatemp, "POST", "pay now, if no jump please click here")
End Function
Private Function Createresult (ByVal status, ByVal Trade_no, ByVal Total_fee, ByVal Out_trade_no)
Set createresult = Server.CreateObject ("Scripting.Dictionary")
Call Createresult.add ("status", status)
If status = False Then
Call Createresult.add ("message", Trade_no)
Else
Call Createresult.add ("Trade_no", Trade_no)
Call Createresult.add ("Out_trade_no", Out_trade_no)
Call Createresult.add ("Total_fee", CSng (Total_fee))
End If
End Function
Public Function GetResult ()
Sparatemp = Getrequestget ()
If IsArray (sparatemp) Then
MySign = Getsignveryfy (sparatemp)
Sresponsetxt = "true"
If request.querystring ("notify_id") <> "" Then
Sresponsetxt = GetResponse (Request.QueryString ("notify_id"))
End If
If mysign = request.querystring ("sign") Then
If Sresponsetxt = "true" Then
If request.querystring ("trade_status") = "trade_finished" or Request.QueryString ("trade_status") = "TRADE_SUCCESS" Then
Set GetResult = Createresult (True, Request.QueryString ("Trade_no"), Request.QueryString ("Total_fee"), Request.QueryString ("Out_trade_no"))
Else
Set GetResult = Createresult (false, payment status error, "", "")
End If
Else
Set GetResult = Createresult (false, check payment status error, "", "")
End If
Else
Set GetResult = Createresult (False, "signature error", "", "")
End If
Else
Set GetResult = Createresult (False, "illegal access", "", "")
End If
End Function
Public Function getnotify ()
Sparatemp = Getrequestpost ()
If IsArray (sparatemp) Then
MySign = Getsignveryfy (sparatemp)
Sresponsetxt = "true"
If request.querystring ("notify_id") <> "" Then
Sresponsetxt = GetResponse (Request.QueryString ("notify_id"))
End If
If mysign = Request.Form ("sign") Then
If Sresponsetxt = "true" Then
If request.querystring ("trade_status") = "trade_finished" or Request.Form ("trade_status") = "trade_success" Then
Set getnotify = Createresult (True, Request.Form ("Trade_no"), Request.Form ("Total_fee"), Request.Form ("Out_trade_no") )
Else
Set getnotify = Createresult (false, payment status error, "", "")
End If
Else
Set getnotify = Createresult (false, check payment status error, "", "")
End If
Else
Set getnotify = Createresult (False, "signature error", "", "")
End If
Else
Set getnotify = Createresult (False, "illegal access", "", "")
End If
End Function
'=====================================================================================
' Summary and functions used (excerpted from ALIPAYSDK)
'=====================================================================================
Private Function GetResponse (notify_id)
Dim sURL, Objhttp, Sresponsetxt
sURL = payverify & "partner=" & Partnerid & "¬ify_id=" & notify_id
Set objhttp = Server.CreateObject ("Microsoft.XMLHTTP")
Objhttp.open "Get", sURL, False, "", ""
Objhttp.send ()
Sresponsetxt = Objhttp.responsetext
Set objhttp = Nothing
GetResponse = Sresponsetxt
End Function
Private Function Getrequestget ()
Dim Spara (), I
i = 0
For each varitem in Request.QueryString
If Varitem <> ActionName Then
Redim Preserve Spara (i)
Spara (i) = varitem & "=" & Request (Varitem)
i = i + 1
End If
Next
If i = 0 Then ' verifies if an array is coming
Getrequestget = ""
Else
Getrequestget = Spara
End If
End Function
Private Function Getrequestpost ()
Dim Spara (), I
i = 0
For each varitem in Request.Form
Redim Preserve Spara (i)
Spara (i) = varitem& "=" &request (varitem)
i = i + 1
Next
If i = 0 Then ' verifies if an array is coming
Getrequestpost = ""
Else
Getrequestpost = Spara
End If
End Function
Public Function Buildrequestform (sparatemp, Smethod, Sbuttonvalue)
Dim sHtml, Ncount
Spara = Buildrequestpara (sparatemp)
sHtml = "<form id=" "Alipaysubmit" "Name=" "Alipaysubmit" "action=" "" & Paygatway & "_input_charset=" & PGCH Arset & "" Method= "" "& Smethod &" ">" & VBCRLF
ncount = UBound (Spara)
For i = 0 to Ncount
IPos = Instr (Spara (i), "=")
Nlen = Len (Spara (i))
Sitemname = Left (Spara (i), iPos-1)
Sitemvalue = Right (Spara (i), Nlen-ipos)
sHtml = sHtml & "<input type=" "Hidden" "Name=" "& Sitemname &" "Value=" "& Sitemvalue &" "/>" & VbCrlf
Next
sHtml = sHtml & "<button type=" "Submit" ">" & Sbuttonvalue & "</button>" & VbCrlf
sHtml = sHtml & "</form>" & VbCrlf
sHtml = sHtml & "<script>document.forms[' Alipaysubmit '].submit ();</script>"
Buildrequestform = sHtml
End Function
Private Function Buildrequestpara (sparatemp)
Dim MySign
Spara = Filterpara (sparatemp)
Sparasort = Sortpara (Spara)
MySign = Buildrequestmysign (sparasort)
ncount = UBound (sparasort)
Redim Preserve Sparasort (ncount+1)
Sparasort (ncount+1) = "sign=" & MySign
Redim Preserve Sparasort (ncount+2)
Sparasort (ncount+2) = "sign_type=" & Signtype
Buildrequestpara = Sparasort
End Function
Private Function Filterpara (Spara)
Dim Sparafilter (), ncount,j
ncount = UBound (Spara)
j = 0
For i = 0 to Ncount
pos = Instr (Spara (i), "=")
Nlen = Len (Spara (i))
ItemName = Left (Spara (i), pos-1)
Itemvalue = Right (Spara (i), Nlen-pos)
If itemname <> "sign" and ItemName <> "Sign_type" and Itemvalue <> "" and IsNull (Itemvalue) = False Then
Redim Preserve Sparafilter (j)
Sparafilter (j) = Spara (i)
j = j + 1
End If
Next
Filterpara = Sparafilter
End Function
Private Function Buildrequestmysign (sparasort)
Prestr = createlinkstring (sparasort)
Select Case Signtype
Case "MD5"
Buildrequestmysign = Md5sign (PRESTR)
Case Else
Buildrequestmysign = ""
End Select
End Function
Private Function Getsignveryfy (sparatemp)
Dim MySign
Spara = Filterpara (sparatemp)
Sparasort = Sortpara (Spara)
Prestr = createlinkstring (sparasort)
Select Case Signtype
Case "MD5"
Getsignveryfy = Md5sign (PRESTR)
Case Else
Getsignveryfy = ""
End Select
End Function
Private Function createlinkstring (Spara)
ncount = UBound (Spara)
Dim Prestr
For i = 0 to Ncount
If i = ncount Then
Prestr = prestr & Spara (i)
Else
Prestr = prestr & Spara (i) & "&"
End If
Next
createlinkstring = Prestr
End Function
Private Function buildrequestparatostring (sparatemp)
Dim Srequestdata
Spara = Buildrequestpara (sparatemp)
Srequestdata = Createlinkstringurlencode (Spara)
buildrequestparatostring = Srequestdata
End Function
Private Function Md5sign (PRESTR)
Prestr = prestr & Partnerkey
MySign = MD5 (PRESTR, Pgcharset)
Md5sign = MySign
End Function
Private Function Delstr (STR)
If IsNull (str) Or isempty (str) Then
STR = ""
End If
Delstr = Replace (Str, ";", "")
Delstr = Replace (Delstr, "'", "")
Delstr = Replace (Delstr, "&", "")
Delstr = Replace (Delstr, "", "")
Delstr = Replace (Delstr, "", "")
Delstr = Replace (Delstr, "%20", "")
Delstr = Replace (Delstr, "--", "")
Delstr = Replace (delstr, "= =", "")
Delstr = Replace (Delstr, "<", "")
Delstr = Replace (Delstr, ">", "")
Delstr = Replace (delstr, "%", "")
End Function
Private Function md5verify (PRESTR, sign)
Prestr = prestr & Partnerkey
MySign = MD5 (PRESTR, Pgcharset)
If mysign = Sign Then
Md5verify = True
Else
Md5verify = False
End If
End Function
Private Function GetDateTime ()
Stime=now ()
Sresult = year (stime) &right ("0" & Month (stime), 2) &right ("0" & Day (Stime), 2) &right ("0" & Hour ( Stime), 2 &right ("0" & Minute (Stime), 2) &right ("0" & Second (stime), 2)
GetDateTime = Sresult
End Function
Private Function Getdatetimeformat ()
Stime=now ()
Sresult = year (stime) & "-" &right ("0" & Month (stime), 2) & "-" &right ("0" & Day (Stime), 2) & "" &right ("0" & Hour (stime), 2) & ":" &right ("0" & Minute (Stime), 2) & ":" &right ("0" & Second ( Stime), 2)
Getdatetimeformat = Sresult
End Function
Private Function Sortpara (Spara)
Dim ncount
ncount = UBound (Spara)
For i = ncount to 0 Step-1
Minmax = Spara (0)
Minmaxslot = 0
For j = 1 to I
Mark = (Spara (j) > Minmax)
If Mark Then
Minmax = Spara (j)
Minmaxslot = J
End If
Next
If Minmaxslot <> i Then
temp = Spara (minmaxslot)
Spara (Minmaxslot) = Spara (i)
Spara (i) = Temp
End If
Next
Sortpara = Spara
End Function
'=====================================================================================
' MD5
'=====================================================================================
Private Sub md5initial ()
Bits_to_a_byte = 8
Bytes_to_a_word = 4
Bits_to_a_word = 32
End Sub
Private M_lonbits (30)
Private M_l2power (30)
Private Function LShift (LValue, Ishiftbits)
If ishiftbits = 0 Then
LShift = LValue
Exit function
ElseIf ishiftbits = Then
If LValue and 1 Then
LShift = &h80000000
Else
LShift = 0
End If
Exit function
ElseIf ishiftbits < 0 Or ishiftbits > Then
Err.Raise 6
End If
If (LValue and M_l2power (31-ishiftbits)) Then
LShift = ((LValue and M_lonbits ()-(ishiftbits + 1)) * M_l2power (ishiftbits)) Or &h80000000
Else
LShift = ((LValue and M_lonbits (31-ishiftbits)) * M_l2power (ishiftbits))
End If
End Function
Private Function Str2bin (VARSTR)
Dim VARASC
Dim I
Dim varchar
Dim Varlow
Dim Varhigh
Str2bin= ""
For I=1 to Len (VARSTR)
Varchar=mid (varstr,i,1)
VARASC = ASC (varchar)
If varasc<0 Then
VARASC = Varasc + 65535
End If
If varasc>255 Then
Varlow = Left (Hex (ASC (varchar)), 2)
Varhigh = Right (Hex (ASC (varchar)), 2)
Str2bin = Str2bin & ChrB ("&h" & Varlow) & ChrB ("&h" & Varhigh)
Else
Str2bin = Str2bin & ChrB (AscB (varchar))
End If
Next
End Function
Private Function Str2bin_utf (VARSTR)
Dim varchar, code, Codearr, J, I
Str2bin_utf = ""
For I=1 to Len (VARSTR)
varchar = Mid (varstr,i,1)
Code = server.urlencode (varchar)
If (code= "+") Then code= "%20"
If Len (code) = 1 Then
Str2bin_utf = Str2bin_utf & ChrB (AscB (code))
Else
Codearr = Split (code, "%")
For j = 1 to UBound (Codearr)
Str2bin_utf = Str2bin_utf & ChrB ("&h" & Codearr (J))
Next
End If
Next
End Function
Private Function Rshift (LValue, Ishiftbits)
If ishiftbits = 0 Then
Rshift = LValue
Exit function
ElseIf ishiftbits = Then
If LValue and &h80000000 Then
Rshift = 1
Else
Rshift = 0
End If
Exit function
ElseIf ishiftbits < 0 Or ishiftbits > Then
Err.Raise 6
End If
Rshift = (lValue and &h7ffffffe) \ M_l2power (ishiftbits)
If (LValue and &h80000000) Then
Rshift = (rshift Or (&h40000000 \ m_l2power (iShiftBits-1))
End If
End Function
Private Function Rotateleft (LValue, Ishiftbits)
Rotateleft = LShift (LValue, ishiftbits) Or Rshift (LValue, (32-ishiftbits))
End Function
Private Function addunsigned (LX, LY)
Dim lX4
Dim lY4
Dim lX8
Dim lY8
Dim Lresult
LX8 = LX and &h80000000
LY8 = LY and &h80000000
LX4 = LX and &h40000000
LY4 = LY and &h40000000
LRESULT = (LX and &H3FFFFFFF) + (LY and &H3FFFFFFF)
If lX4 and LY4 Then
LRESULT = Lresult xor &h80000000 xor LX8 xor lY8
ElseIf lX4 Or lY4 Then
If Lresult and &h40000000 Then
LRESULT = Lresult xor &hc0000000 xor LX8 xor lY8
Else
LRESULT = Lresult xor &h40000000 xor LX8 xor lY8
End If
Else
LRESULT = Lresult XOR lX8 xor lY8
End If
addunsigned = Lresult
End Function
Private function Md5_f (x, Y, z)
Md5_f = (x and y) Or (not x) and Z)
End Function
Private function Md5_g (x, Y, z)
Md5_g = (x and z) Or (y and not z)
End Function
Private function Md5_h (x, Y, z)
Md5_h = (x xor y xor Z)
End Function
Private function Md5_i (x, Y, z)
Md5_i = (y Xor (x Or not z))
End Function
Private Sub md5_ff (A, B, C, D, X, S, AC)
A = addunsigned (A, addunsigned (addunsigned (Md5_f (b, C, D), x), AC)
A = Rotateleft (A, s)
A = Addunsigned (A, B)
End Sub
Private Sub Md5_gg (A, B, C, D, X, S, AC)
A = addunsigned (A, addunsigned (addunsigned (Md5_g (b, C, D), x), AC)
A = Rotateleft (A, s)
A = Addunsigned (A, B)
End Sub
Private Sub md5_hh (A, B, C, D, X, S, AC)
A = addunsigned (A, addunsigned (addunsigned (Md5_h (b, C, D), x), AC)
A = Rotateleft (A, s)
A = Addunsigned (A, B)
End Sub
Private Sub Md5_ii (A, B, C, D, X, S, AC)
A = addunsigned (A, addunsigned (addunsigned (md5_i (b, C, D), x), AC)
A = Rotateleft (A, s)
A = Addunsigned (A, B)
End Sub
Private Function Converttowordarray (smessage)
Dim Lmessagelength
Dim Lnumberofwords
Dim Lwordarray ()
Dim lbyteposition
Dim Lbytecount
Dim Lwordcount
Const modulus_bits = 512
Const congruent_bits = 448
Lmessagelength = LenB (smessage)
Lnumberofwords = ((Lmessagelength + ((modulus_bits-congruent_bits) \ Bits_to_a_byte)) \ (modulus_bits \ BITS_TO_A_BYTE) ) + 1) * (modulus_bits \ Bits_to_a_word)
ReDim Lwordarray (lNumberOfWords-1)
lbyteposition = 0
Lbytecount = 0
Do Until lbytecount >= lmessagelength
Lwordcount = lbytecount \ Bytes_to_a_word
Lbyteposition = (Lbytecount Mod bytes_to_a_word) * Bits_to_a_byte
Lwordarray (Lwordcount) = Lwordarray (Lwordcount) Or LShift (AscB (MidB (smessage, Lbytecount + 1, 1)), lbyteposition)
Lbytecount = Lbytecount + 1
Loop
Lwordcount = lbytecount \ Bytes_to_a_word
Lbyteposition = (Lbytecount Mod bytes_to_a_word) * Bits_to_a_byte
Lwordarray (Lwordcount) = Lwordarray (Lwordcount) Or lshift (&h80, lbyteposition)
Lwordarray (lNumberOfWords-2) = LShift (Lmessagelength, 3)
Lwordarray (lNumberOfWords-1) = Rshift (lmessagelength, 29)
Converttowordarray = Lwordarray
End Function
Private Function Wordtohex (lValue)
Dim Lbyte
Dim Lcount
For lcount = 0 to 3
Lbyte = Rshift (LValue, Lcount * bits_to_a_byte) and m_lonbits (bits_to_a_byte-1)
Wordtohex = Wordtohex & Right ("0" & Hex (Lbyte), 2)
Next
End Function
Public Function MD5 (smessage, Input_charset)
M_lonbits (0) = CLng (1)
M_lonbits (1) = CLng (3)
M_lonbits (2) = CLng (7)
M_lonbits (3) = CLng (15)
M_lonbits (4) = CLng (31)
M_lonbits (5) = CLng (63)
M_lonbits (6) = CLng (127)
M_lonbits (7) = CLng (255)
M_lonbits (8) = CLng (511)
M_lonbits (9) = CLng (1023)
M_lonbits (+) = CLng (2047)
M_lonbits (one) = CLng (4095)
M_lonbits (a) = CLng (8191)
M_lonbits (+) = CLng (16383)
M_lonbits (+) = CLng (32767)
M_lonbits (+) = CLng (65535)
M_lonbits (+) = CLng (131071)
M_lonbits (+) = CLng (262143)
M_lonbits (km) = CLng (524287)
M_lonbits (a) = CLng (1048575)
M_lonbits (+) = CLng (2097151)
M_lonbits = CLng (4194303)
M_lonbits (+) = CLng (8388607)
M_lonbits (+) = CLng (16777215)
M_lonbits (+) = CLng (33554431)
M_lonbits (+) = CLng (67108863)
M_lonbits (num) = CLng (134217727)
M_lonbits (+) = CLng (268435455)
M_lonbits = CLng (536870911)
M_lonbits (+) = CLng (1073741823)
M_lonbits (+) = CLng (2147483647)
M_l2power (0) = CLng (1)
M_l2power (1) = CLng (2)
M_l2power (2) = CLng (4)
M_l2power (3) = CLng (8)
M_l2power (4) = CLng (16)
M_l2power (5) = CLng (32)
M_l2power (6) = CLng (64)
M_l2power (7) = CLng (128)
M_l2power (8) = CLng (256)
M_l2power (9) = CLng (512)
M_l2power (+) = CLng (1024)
M_l2power (one) = CLng (2048)
M_l2power (a) = CLng (4096)
M_l2power (+) = CLng (8192)
M_l2power (+) = CLng (16384)
M_l2power (+) = CLng (32768)
M_l2power (+) = CLng (65536)
M_l2power (+) = CLng (131072)
M_l2power (km) = CLng (262144)
M_l2power (a) = CLng (524288)
M_l2power (+) = CLng (1048576)
M_l2power = CLng (2097152)
M_l2power (+) = CLng (4194304)
M_l2power (+) = CLng (8388608)
M_l2power (+) = CLng (16777216)
M_l2power (+) = CLng (33554432)
M_l2power (num) = CLng (67108864)
M_l2power (+) = CLng (134217728)
M_l2power = CLng (268435456)
M_l2power (+) = CLng (536870912)
M_l2power (+) = CLng (1073741824)
Dim x
Dim K
Dim AA
Dim BB
Dim CC
Dim DD
Dim A
Dim b
Dim C
Dim D
Const S11 = 7
Const S12 = 12
Const S13 = 17
Const S14 = 22
Const S21 = 5
Const S22 = 9
Const S23 = 14
Const S24 = 20
Const S31 = 4
Const S32 = 11
Const S33 = 16
Const S34 = 23
Const S41 = 6
Const S42 = 10
Const S43 = 15
Const S44 = 21
If LCase (Input_charset) = "Utf-8" Then
x = Converttowordarray (Str2bin_utf (smessage))
Else
x = Converttowordarray (Str2bin (smessage))
End If
A = &h67452301
b = &hefcdab89
c = &h98badcfe
D = &h10325476
For k = 0 to UBound (x) Step 16
AA = A
BB = b
CC = C
DD = d
Md5_ff A, B, C, D, X (k + 0), S11, &hd76aa478
Md5_ff D, A, B, C, x (k + 1), S12, &he8c7b756
Md5_ff C, D, a, B, X (k + 2), S13, &h242070db
Md5_ff B, C, D, A, X (K + 3), S14, &hc1bdceee
Md5_ff A, B, C, D, X (K + 4), S11, &HF57C0FAF
Md5_ff D, A, B, C, X (K + 5), S12, &h4787c62a
Md5_ff C, D, a, B, X (k + 6), S13, &ha8304613
Md5_ff B, C, D, A, X (k + 7), S14, &hfd469501
Md5_ff A, B, C, D, X (K + 8), S11, &h698098d8
Md5_ff D, A, B, C, X (K + 9), S12, &H8B44F7AF
Md5_ff C, D, a, B, X (k +), S13, &HFFFF5BB1
Md5_ff B, C, D, A, X (k + one), S14, &h895cd7be
Md5_ff A, B, C, D, X (K +), S11, &h6b901122
Md5_ff D, A, B, C, X (K +), S12, &hfd987193
Md5_ff C, D, a, B, X (k +), S13, &ha679438e
Md5_ff B, C, D, A, X (k +), S14, &h49b40821
Md5_gg A, B, C, D, X (k + 1), S21, &hf61e2562
Md5_gg D, A, B, C, X (K + 6), S22, &hc040b340
Md5_gg C, D, a, B, X (k + one), S23, &h265e5a51
Md5_gg B, C, D, A, X (k + 0), S24, &HE9B6C7AA
Md5_gg A, B, C, D, X (K + 5), S21, &hd62f105d
Md5_gg D, A, B, C, X (K +), S22, &h2441453
Md5_gg C, D, a, B, X (k +), S23, &hd8a1e681
Md5_gg B, C, D, A, X (K + 4), S24, &he7d3fbc8
Md5_gg A, B, C, D, X (K + 9), S21, &h21e1cde6
Md5_gg D, A, B, C, X (K +), S22, &hc33707d6
Md5_gg C, D, a, B, X (k + 3), S23, &hf4d50d87
Md5_gg B, C, D, A, X (K + 8), S24, &h455a14ed
Md5_gg A, B, C, D, X (K +), S21, &ha9e3e905
Md5_gg D, A, B, C, X (K + 2), S22, &hfcefa3f8
Md5_gg C, D, a, B, X (k + 7), S23, &h676f02d9
Md5_gg B, C, D, A, X (k +), S24, &h8d2a4c8a
Md5_hh A, B, C, D, X (K + 5), S31, &hfffa3942
Md5_hh D, A, B, C, X (K + 8), S32, &h8771f681
Md5_hh C, D, a, B, X (k + one), S33, &h6d9d6122
Md5_hh B, C, D, A, X (k +), S34, &hfde5380c
Md5_hh A, B, C, D, X (k + 1), S31, &ha4beea44
Md5_hh D, A, B, C, X (K + 4), S32, &h4bdecfa9
Md5_hh C, D, a, B, X (k + 7), S33, &hf6bb4b60
Md5_hh B, C, D, A, X (k +), S34, &hbebfbc70
Md5_hh A, B, C, D, X (K +), S31, &H289B7EC6
Md5_hh D, A, B, C, x (k + 0), S32, &HEAA127FA
Md5_hh C, D, a, B, X (k + 3), S33, &hd4ef3085
Md5_hh B, C, D, A, X (k + 6), S34, &h4881d05
Md5_hh A, B, C, D, X (K + 9), S31, &hd9d4d039
Md5_hh D, A, B, C, X (K +), S32, &he6db99e5
Md5_hh C, D, a, B, X (k +), S33, &h1fa27cf8
Md5_hh B, C, D, A, X (K + 2), S34, &hc4ac5665
Md5_ii A, B, C, D, X (k + 0), S41, &hf4292244
Md5_ii D, A, B, C, X (k + 7), S42, &h432aff97
Md5_ii C, D, a, B, X (k +), S43, &hab9423a7
Md5_ii B, C, D, A, X (K + 5), S44, &hfc93a039
Md5_ii A, B, C, D, X (K +), S41, &H655B59C3
Md5_ii D, A, B, C, X (K + 3), S42, &h8f0ccc92
Md5_ii C, D, a, B, X (k +), S43, &hffeff47d
Md5_ii B, C, D, A, X (k + 1), S44, &H85845DD1
Md5_ii A, B, C, D, X (K + 8), S41, &h6fa87e4f
Md5_ii D, A, B, C, X (K +), S42, &HFE2CE6E0
Md5_ii C, D, a, B, X (k + 6), S43, &ha3014314
Md5_ii B, C, D, A, X (k +), S44, &H4E0811A1
Md5_ii A, B, C, D, X (K + 4), S41, &hf7537e82
Md5_ii D, A, B, C, X (K + one), S42, &hbd3af235
Md5_ii C, D, a, B, X (k + 2), S43, &H2AD7D2BB
Md5_ii B, C, D, A, X (k + 9), S44, &heb86d391
A = addunsigned (A, AA)
b = addunsigned (b, BB)
c = addunsigned (c, CC)
D = addunsigned (d, DD)
Next
MD5 = LCase (Wordtohex (a) & Wordtohex (b) & Wordtohex (c) & Wordtohex (d))
End Function
End Class
Create a form
Set Alipay = new Alipayclass
Alipay.notifyurl = "" ' Background notification address, if not set, the system automatically invokes http://current domain name/order/notify.asp
Alipay.callbackurl = "" ' Customer pays return address, if not set, automatically invokes http://current domain/current page. Asp?action=callback
Alipay.actionname = action in the URL of "action"
Trade_no = "Order Number"
title = "Order title"
BODY = "Order Details"
Paymoney = 1 ' Order Amount
Response.Write Alipay. Pay (Trade_no, title, body, Paymoney)
User pays callback
Set Alipay = new Alipayclass
Set result = Alipay. GetResult ()
If Result.item ("status") = False Then
Response.Write Result.item ("message") ' Book error messages
Else
Out_trade_no = Result.item ("Out_trade_no")
Total_fee = Result.item ("Total_fee")
Trade_no = Result.item ("Trade_no")
If IsNumeric (out_trade_no) and IsNumeric (Total_fee) Then
' Business processes, and database comparisons
' Payment completed
End If
End If
Background notification, the result format returned and the user pays the callback in the same format
Set Alipay = new Alipayclass
Set result = Alipay. Getnotify ()
If Result.item ("status") = False Then
Response.Write Result.item ("message") ' book error message
Else
out_trade_no = result.item ("Out_trade_no")
total_fee = result.item ("Total_fee")
trade_no = result.item ("Trade_no ")
if IsNumeric (out_trade_no) and IsNumeric (Total_fee) then
' business process, and database comparison
Response.Write ' SUCCESS '
End If
End if