NET Silver Online payment interface Code
<%
Class webpayment_cls
private spaymentid, Spaymentkey, Sreturnurl, Splatform, spstate
private sOrderID, Spaymoney, Smoneytype, Slanguage,sfd_npsid
Private scomment, Sremark, Sconsigner, Submit_value
private sconsignee, saddress, Spostcode, STelephone, Semail
public errnumber, mpercent
private strchinaebank, Sencrypt
private PaymentContent
Private Sub Class_Initialize ()
On Error Resume Next
Spaymentid = "1051011239"
Spaymentkey = "newasp778899"
Sreturnurl = "Http://www.111cn.net"
Splatform = 1
sOrderID = "2005328-1001-5188"
Spaymoney = "100.00"
Smoneytype = 1
Slanguage = 1
Spstate = 0
scomment = "Online Payment"
Sremark = "Online Payment"
Sconsigner = "Consigner"
Sconsignee = "Consignee"
saddress = "Wuhan"
Spostcode = "51800"
Stelephone = "027-5188888"
Semail = "Email@email.com"
Submit_value = "Enter the online payment platform"
Sencrypt = "12345678"
mpercent = 0
End Sub
Private Sub Class_Terminate ()
End Sub
'----error code
Public Property Get Description ()
Select Case Errnumber
Case 1:description = "Order number error." "
Case 2:description = "Payment amount is wrong!" "
Case 3:description = "Authentication signature cannot be NULL!"
Case 4:description = "Authentication information error, this transaction failed!!! "
Case 5:description = "Authentication information error, please do not repeat the submission of data, this transaction failed!!! "
Case 6:description = "Sorry!" This site has not opened online payment function, please choose another way to pay "
Case 7:description = "Wrong system parameters"
Case 8:description = "This site has not opened online payment function, or the site program is not registered, please choose another way to pay"
Case Else
Description = Empty
End Select
End Property
'----fee percentage
Public Property Let Percent (ByVal newvalue)
Mpercent = newvalue
End Property
'----Payment Platform
Public Property Let Payplatform (ByVal newvalue)
Splatform = newvalue
End Property
'----Payment ID
Public Property Let Paymentid (ByVal newvalue)
Spaymentid = newvalue
If Trim (Spaymentid) = "" Then
Spaymentid = "1051011239"
End If
End Property
Public Property Get Paymentid ()
Paymentid = Spaymentid
End Property
'----Payment key
Public Property Let Paymentkey (ByVal newvalue)
Spaymentkey = newvalue
If Trim (Spaymentkey) = "" Then
Spaymentkey = "Newasp778899"
End If
End Property
'----return URL
Public Property Let ReturnUrl (ByVal newvalue)
Sreturnurl = newvalue
End Property
'----Trading status
Public Property Let Pstate (ByVal newvalue)
Spstate = newvalue
End Property
Public Property Get Pstate ()
Pstate = Spstate
End Property
'---order number
Public Property Let Orderid (ByVal newvalue)
sOrderID = newvalue
End Property
Public Property Get Orderid ()
Orderid = sOrderID
End Property
Public Property Get Fd_npsid ()
Fd_npsid = Sfd_npsid
End Property
'----Payment amount
Public Property Let Paymoney (ByVal newvalue)
Spaymoney = Readpaymoney (newvalue, False)
End Property
Public Property Get Paymoney ()
Paymoney = Spaymoney
End Property
'----Transaction amount
Public Property Get Buymoney ()
Buymoney = Readpaymoney (Spaymoney, True)
End Property
'----Handling fee
Public Property Get Servicecharge ()
Servicecharge = Spaymoney-readpaymoney (Spaymoney, True)
End Property
'----Payment currency
Public Property Let Moneytype (ByVal newvalue)
Smoneytype = newvalue
End Property
Public Property Get Moneytype ()
Moneytype = Smoneytype
End Property
'----Payment language
Public Property Let Planguage (ByVal newvalue)
Slanguage = newvalue
End Property
'----Pay notes
Public Property Let Comment (ByVal newvalue)
Scomment = newvalue
End Property
Public Property Get Comment ()
Comment = Scomment
End Property
'----Pay notes
Public Property Let remark (ByVal NewValue)
Sremark = newvalue
End Property
Public Property Get Remark ()
Remark = Sremark
End Property
'----Consignee name
Public Property Let consignee (ByVal newvalue)
Sconsignee = newvalue
End Property
Public Property Get Consignee ()
Consignee = Sconsignee
End Property
'----Consignee address
Public Property Let address (ByVal NewValue)
Saddress = newvalue
End Property
Public Property Get Address ()
Address = Saddress
End Property
'----Consignee postcode
Public Property Let postcode (ByVal NewValue)
Spostcode = newvalue
End Property
Public Property Get Postcode ()
Postcode = Spostcode
End Property
'----Consignee telephone
Public Property Let telephone (ByVal newvalue)
Stelephone = newvalue
End Property
Public Property Get Telephone ()
Telephone = Stelephone
End Property
'----Consignee E_Mail
Public Property Let Email (ByVal newvalue)
Semail = newvalue
End Property
Public Property Get Email ()
Email = Semail
End Property
'----consignor.
Public Property Let Consigner (ByVal newvalue)
Sconsigner = newvalue
End Property
Public Property Get Consigner ()
Consigner = Sconsigner
End Property
'----Submit button
Public Property Let Submitvalue (ByVal newvalue)
Submit_value = newvalue
End Property
'----encrypted password
Public Property Let Encrypt (ByVal newvalue)
Sencrypt = newvalue
End Property
'================================================
' Procedure name: Getwebsiteurl
' function: Get URL with Port
'================================================
Public Property Get Getwebsiteurl ()
If Request.ServerVariables ("server_port") = "Then"
Getwebsiteurl = "http://" & Request.ServerVariables ("SERVER_NAME")
Else
Getwebsiteurl = "http://" & Request.ServerVariables ("SERVER_NAME") & ":" & Request.ServerVariables ("Server _port ")
End If
End Property
'================================================
' Procedure name: Paymentplatform
' Role: Online payment platform
'================================================
Public Sub Paymentplatform ()
On Error Resume Next
If splatform = 1 Then
Call Payment_nps
ElseIf Splatform = 2 Then
Call Payment_chinabank
Else
Errnumber = 6
Exit Sub
End If
Response.Write Paymentcontent
End Sub
'================================================
' Function name: showpayment
' Function: Show online payment platform
'================================================
Public Function showpayment ()
On Error Resume Next
If splatform = 1 Then
Call Payment_nps
ElseIf Splatform = 2 Then
Call Payment_chinabank
Else
Showpayment = ""
Errnumber = 6
Exit Function
End If
Showpayment = Paymentcontent
End Function
'================================================
' Procedure name: Payment_nps
' Role: NPS online payment Platform
'================================================
Private Sub Payment_nps ()
On Error Resume Next
Dim Digest, Ordermessage
Dim M_url, M_orderid, M_oamount, Modate, m_ocomment
Dim m_ocurrency, M_language, S_postcode, S_tel, S_eml, R_postcode, R_tel, r_eml
M_orderid = Trim (sOrderID) '----order number
M_oamount = Spaymoney '----amount
M_url = Sreturnurl '----return URL
M_ocurrency = Smoneytype '----currency
M_language = Slanguage '----language selection
S_postcode = Spostcode '----Consumer mailing code
S_tel = Stelephone '----Consumer mailing code
S_EML = semail '----Consumer mail
R_postcode = Spostcode '----Consignee telephone
R_tel = Stelephone '----Consignee telephone
R_EML = Semail '----Consignee mail
M_ocomment = Scomment '----notes
Modate = Date '----dates
Ordermessage = Spaymentid & M_orderid & M_oamount & m_ocurrency & M_url & M_language & S_postcode & S_tel & s_eml & R_postcode & R_tel & r_eml & modate & Spaymentkey
Digest = UCase (Trim (VMD). MD5 (Ordermessage,true))
Paymentcontent = "<table> <tr>" & vbNewLine
Paymentcontent = paymentcontent & "<form method=" "Post" "action=" "https://payment.nps.cn/ Virreceivemerchantaction.do "" Name= "" Payform "" target= "" _blank "" > "& vbNewLine
Paymentcontent = paymentcontent & "<td>" & vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "m_id" "Value=" "" & Spaymentid & "" > "& Amp vbNewLine '----Merchant number
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Morderid" "Value=" "" & M_orderid & "" "" ; "& vbNewLine '----order number
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Moamount" "Value=" "" & M_oamount & "" "" ; "& vbNewLine '----Order Amount
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Mocurrency" "Value=" "" & M_ocurrency & "" ">" & vbnewline '----currency
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "M_url" "Value=" "" & M_url & "" > "& vbNewLine '----return address
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "M_language" "Value=" "" & M_language & "" " > "& vbnewline '----Language choice
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "S_name" "Value=" "" & Sconsignee & "" > "& vbNewLine '----consumer name
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "s_address" "Value=" "" & Saddress & "" "" ; "& vbNewLine '----consumer address
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "S_postcode" "Value=" "" & S_postcode & "" " > "& vbnewline '----Consumer mailing code
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "S_telephone" "Value=" "" & S_tel & "" > "& vbNewLine '----consumer telephone
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "S_email" "Value=" "" & S_eml & "" > "&am P vbNewLine '----Consumer mail
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "R_name" "Value=" "" & Sconsignee & "" > "& vbNewLine '----consignee name
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "r_address" "Value=" "" & Saddress & "" "" ; "& vbNewLine '----Consignee's address
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "R_postcode" "Value=" "" & R_postcode & "" " > "& vbnewline '----Consignee postal code
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "R_telephone" "Value=" "" & R_tel & "" > "& vbnewline '----consignee telephone
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "R_email" "Value=" "" & R_eml & "" > "&am P vbNewLine '----Consignee mail
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Mocomment" "Value=" "" & M_ocomment & "" " gt; "& vbNewLine '----notes
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Modate" "Value=" "" & Modate & "" > "&am P vbNewLine '----Time field
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "state" "Value=" "& Spstate &" ">" &am P vbNewLine '----Trading status
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Digestinfo" "Value=" "" & Digest & "" > "& vbNewLine '----Signature Certification
Paymentcontent = paymentcontent & "<input type=" "Submit" "Name=" "Submit" "Value=" "" & Submit_value & "" cl ass= "button" ">" & vbnewline '----Confirm payment
Paymentcontent = paymentcontent & "</td> </tr>" & vbNewLine
Paymentcontent = paymentcontent & "</form>" & vbNewLine
Paymentcontent = paymentcontent & "</table>" & vbNewLine
End Sub
'================================================
' Procedure name: Payment_chinabank
' Function: Online payment platform for Silver net
'================================================
Private Sub Payment_chinabank ()
On Error Resume Next
Dim V_mid, V_amount, v_oid, V_moneytype, style, V_url, REMARK1, REMARK2
Dim Ordermessage, V_md5info
Dim V_rcvname, V_rcvaddr, V_rcvtel, V_rcvpost, V_ordername, V_orderemail
V_mid = Spaymentid '----Merchant number
V_amount = Spaymoney '----amount
V_oid = Trim (sOrderID) '----order number
V_moneytype = "CNY" '----currency
style = Spstate '----refers to Gateway Mode 0 (normal), 1 (with foreign cards in the bank list)
V_url = Sreturnurl '----return URL
Remark1 = Scomment '----NOTE 1
REMARK2 = Stelephone '----NOTE 2
Ordermessage = V_amount & V_moneytype & v_oid & V_mid & V_url & Spaymentkey
V_md5info = UCase (Trim (VMD). MD5 (ordermessage,true)) ' Net Silver Payment platform for MD5 value only uppercase string, so lowercase MD5 is worth converting to uppercase
' ********** the following items have nothing to do with online payment, it is not recommended to **************
V_rcvname = Sconsignee '----consignee
V_RCVADDR = Saddress '----Consignee address
V_rcvtel = Stelephone '----Consignee telephone
V_rcvpost = "430015" '----Consumer mailing code
V_ordername = Sconsigner '----shipper
V_orderemail = Semail '----Consignee mail
Paymentcontent = "<table> <tr>" & vbNewLine
Paymentcontent = paymentcontent & "<form method=" "Post" "action=" "Https://pay3.chinabank.com.cn/PayGate" "Name = "" Payform "" target= "" _blank "" > "& vbNewLine
Paymentcontent = paymentcontent & "<td>" & vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_md5info" "Value=" "" & V_md5info & "" "&G t; "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_mid" "Value=" "" & V_mid & "" > "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_oid" "Value=" "" & V_oid & "" > "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_amount" "Value=" "" & V_amount & "" > "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_moneytype" "Value=" "& V_moneytype &" ">" & vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_url" "Value=" "" & V_url & "" > "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Style" "value=" "& Style &" ">" & vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Remark1" "Value=" "" & Remark1 & "" > "& Amp vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "Remark2" "Value=" "" & Remark2 & "" > "& Amp vbNewLine
'-----The following items have nothing to do with online payment, it is not recommended to----
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_rcvname" "Value=" "" & V_rcvname & "" "&G t; "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_rcvaddr" "Value=" "" & V_rcvaddr & "" "&G t; "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_rcvtel" "Value=" "" & V_rcvtel & "" > "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_rcvpost" "Value=" "" & V_rcvpost & "" "&G t; "& vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_ordername" "Value=" "& V_ordername &" ">" & vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_orderpost" "value=" "430015" ">" & Vbne Wline
Paymentcontent = paymentcontent & "<input type=" "Hidden" "name=" "V_orderemail" "Value=" "" & V_orderemail ; "" ">" & vbNewLine
Paymentcontent = paymentcontent & "<input type=" "Submit" "Name=" "V_action" "Value=" "" & Submit_value & "" " class= "button" ">" & vbNewLine
Paymentcontent = paymentcontent & "</td> </tr>" & vbNewLine
Paymentcontent = paymentcontent & "</form>" & vbNewLine
Paymentcontent = paymentcontent & "</table>" & vbNewLine
End Sub
'================================================
' Procedure name: Receivepage
' Function: Online payment return page
'================================================
Public Sub Receivepage ()
On Error Resume Next
If CInt (splatform) = 1 Then
Call Receive_nps
ElseIf CInt (splatform) = 2 Then
Call Receive_chinabank
Else
Errnumber = 6
Exit Sub
End If
End Sub
Private Sub Receive_nps ()
On Error Resume Next
Dim ordermessage, Md5text, Bankpaycode, Md5info
Spaymentid = Trim (Request ("m_id")) '----Merchant number
Sfd_npsid = Trim (Request ("Fd_npsid")) '----NPS order number
sOrderID = Trim (Request ("M_orderid")) '----order number
Spaymoney = Trim (Request ("M_oamount")) '----Order Amount
Scomment = Trim (Request ("m_ocomment")) '----notes
Sconsignee = Trim (Request ("R_name")) '----consignee
saddress = Trim (Request ("r_addr")) '----consignee address
Spostcode = Trim (Request ("R_postcode")) '----consignee postcode
Stelephone = Trim (Request ("R_tel")) '----consignee telephone
Semail = Trim (Request ("r_eml")) '----Consignee e-mail
Sconsigner = Trim (Request ("S_name")) '----shipper
Spstate = Trim (Request ("M_status")) '----transaction status
Smoneytype = Trim (Request ("m_ocurrency")) '----currency
Md5info = Trim (Request ("Newmd5info")) '----Signature authentication
If Trim (Request ("md5info") = "" Then
Errnumber = 3
Exit Sub
End If
Ordermessage = Spaymentid & sOrderID & Spaymoney & Spaymentkey & Spstate
Md5text = Trim (VMD. MD5 (Ordermessage,true))
If UCase (Md5text) <> UCase (md5info) Then
Errnumber = 4
Exit Sub
Else
If chknumeric (spstate) = 2 Then
'----paid successfully
Errnumber = 0
Exit Sub
Else
Errnumber = 4
Exit Sub
End If
End If
End Sub
Private Sub Receive_chinabank ()
On Error Resume Next
Dim v_md5str, Md5text, Ordermessage, Bankpaycode
Spaymentid = Spaymentid '----Merchant number
sOrderID = Trim (Request ("v_oid")) '----order number
Spaymoney = Trim (Request ("V_amount")) '----Order Amount
Scomment = Trim (Request ("Remark1")) '----notes
Sconsignee = Trim (Request ("V_rcvname")) '----consignee
saddress = Trim (Request ("v_rcvaddr")) '----consignee address
Spostcode = Trim (Request ("V_rcvpost")) '----consignee postcode
Stelephone = Trim (Request ("Remark2")) '----consignee telephone
Semail = Trim (Request ("V_orderemail")) '----Consignee e-mail
Sconsigner = Trim (Request ("V_ordername")) '----shipper
Smoneytype = Trim (Request ("V_moneytype")) '----currency
Spstate = Trim (Request ("V_pstatus")) '----transaction status
V_md5str = Trim (Request ("V_md5str"))
If Trim (Request ("v_md5str") = "" Then
Errnumber = 3
Exit Sub
End If
Ordermessage = sOrderID & spstate & Spaymoney & Smoneytype & Spaymentkey
Md5text = Trim (VMD. MD5 (Ordermessage,true))
If UCase (Md5text) <> UCase (V_MD5STR) Then
Errnumber = 4
Exit Sub
Else
If chknumeric (spstate) = Then
'----paid successfully
Errnumber = 0
Exit Sub
Else
'----Payment failed
Errnumber = 4
Exit Sub
End If
End If
End Sub
'=============================================================
' Function name: Readpaymoney
' function: Read the money to be paid
' Parameter: Money----actual cash
' Return value: plus the money after the handling fee
'=============================================================
Public Function Readpaymoney (ByVal, ByVal Reduce)
On Error Resume Next
If Money = 0 Then
Readpaymoney = 0
Exit Function
End If
Dim Moneypercent, Valpercent
Moneypercent = mpercent/100
If moneypercent = 0 Then
Readpaymoney = Money
Else
If CBool (Reduce) = True Then
Valpercent = Round (Money/(1 + 1 * moneypercent), 2)
Readpaymoney = CCur (valpercent)
Else
Valpercent = Round (Money * moneypercent, 2)
Readpaymoney = CCur (Money + valpercent)
End If
End If
End Function
Public Function chknumeric (ByVal check_id)
If check_id <> "" and IsNumeric (check_id) Then _
check_id = CLng (check_id) _
Else _
check_id = 0
Chknumeric = check_id
End Function
End Class
%>