NET Silver Online Payment Code

Source: Internet
Author: User
Tags error code md5 servervariables trim let encrypt

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://" &amp; Request.ServerVariables ("SERVER_NAME")


Else


Getwebsiteurl = "http://" &amp; Request.ServerVariables ("SERVER_NAME") &amp; ":" &amp; 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 &amp; M_orderid &amp; M_oamount &amp; m_ocurrency &amp; M_url &amp; M_language &amp; S_postcode &amp; S_tel &amp; s_eml &amp; R_postcode &amp; R_tel &amp; r_eml &amp; modate &amp; Spaymentkey


Digest = UCase (Trim (VMD). MD5 (Ordermessage,true))





Paymentcontent = "&lt;table&gt; &lt;tr&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;form method=" "Post" "action=" "https://payment.nps.cn/ Virreceivemerchantaction.do "" Name= "" Payform "" target= "" _blank "" &gt; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;td&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "m_id" "Value=" "" &amp; Spaymentid &amp; "" &gt; "& Amp vbNewLine '----Merchant number


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Morderid" "Value=" "" &amp; M_orderid &amp; "" "" ; "&amp; vbNewLine '----order number


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Moamount" "Value=" "" &amp; M_oamount &amp; "" "" ; "&amp; vbNewLine '----Order Amount


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Mocurrency" "Value=" "" &amp; M_ocurrency &amp; "" "&gt;" &amp; vbnewline '----currency


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "M_url" "Value=" "" &amp; M_url &amp; "" &gt; "&amp; vbNewLine '----return address


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "M_language" "Value=" "" &amp; M_language &amp; "" " &gt; "&amp; vbnewline '----Language choice


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "S_name" "Value=" "" &amp; Sconsignee &amp; "" &gt; "&amp; vbNewLine '----consumer name


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "s_address" "Value=" "" &amp; Saddress &amp; "" "" ; "&amp; vbNewLine '----consumer address


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "S_postcode" "Value=" "" &amp; S_postcode &amp; "" " &gt; "&amp; vbnewline '----Consumer mailing code


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "S_telephone" "Value=" "" &amp; S_tel &amp; "" &gt; "&amp; vbNewLine '----consumer telephone


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "S_email" "Value=" "" &amp; S_eml &amp; "" &gt; "&am P vbNewLine '----Consumer mail


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "R_name" "Value=" "" &amp; Sconsignee &amp; "" &gt; "&amp; vbNewLine '----consignee name


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "r_address" "Value=" "" &amp; Saddress &amp; "" "" ; "&amp; vbNewLine '----Consignee's address


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "R_postcode" "Value=" "" &amp; R_postcode &amp; "" " &gt; "&amp; vbnewline '----Consignee postal code


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "R_telephone" "Value=" "" &amp; R_tel &amp; "" &gt; "&amp; vbnewline '----consignee telephone


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "R_email" "Value=" "" &amp; R_eml &amp; "" &gt; "&am P vbNewLine '----Consignee mail


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Mocomment" "Value=" "" &amp; M_ocomment &amp; "" " gt; "&amp; vbNewLine '----notes


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Modate" "Value=" "" &amp; Modate &amp; "" &gt; "&am P vbNewLine '----Time field


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "state" "Value=" "&amp; Spstate &amp;" "&gt;" &am P vbNewLine '----Trading status


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Digestinfo" "Value=" "" &amp; Digest &amp; "" &gt; "&amp; vbNewLine '----Signature Certification


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Submit" "Name=" "Submit" "Value=" "" &amp; Submit_value &amp; "" cl ass= "button" "&gt;" &amp; vbnewline '----Confirm payment


Paymentcontent = paymentcontent &amp; "&lt;/td&gt; &lt;/tr&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;/form&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;/table&gt;" &amp; 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 = "&lt;table&gt; &lt;tr&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;form method=" "Post" "action=" "Https://pay3.chinabank.com.cn/PayGate" "Name = "" Payform "" target= "" _blank "" &gt; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;td&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_md5info" "Value=" "" &amp; V_md5info &amp; "" "&G t; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_mid" "Value=" "" &amp; V_mid &amp; "" &gt; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_oid" "Value=" "" &amp; V_oid &amp; "" &gt; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_amount" "Value=" "" &amp; V_amount &amp; "" &gt; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_moneytype" "Value=" "&amp; V_moneytype &amp;" "&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_url" "Value=" "" &amp; V_url &amp; "" &gt; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Style" "value=" "&amp; Style &amp;" "&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Remark1" "Value=" "" &amp; Remark1 &amp; "" &gt; "& Amp vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "Remark2" "Value=" "" &amp; Remark2 &amp; "" &gt; "& Amp vbNewLine


'-----The following items have nothing to do with online payment, it is not recommended to----


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_rcvname" "Value=" "" &amp; V_rcvname &amp; "" "&G t; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_rcvaddr" "Value=" "" &amp; V_rcvaddr &amp; "" "&G t; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_rcvtel" "Value=" "" &amp; V_rcvtel &amp; "" &gt; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_rcvpost" "Value=" "" &amp; V_rcvpost &amp; "" "&G t; "&amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_ordername" "Value=" "&amp; V_ordername &amp;" "&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_orderpost" "value=" "430015" "&gt;" &amp; Vbne Wline


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Hidden" "name=" "V_orderemail" "Value=" "" &amp; V_orderemail ; "" "&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;input type=" "Submit" "Name=" "V_action" "Value=" "" &amp; Submit_value &amp; "" " class= "button" "&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;/td&gt; &lt;/tr&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;/form&gt;" &amp; vbNewLine


Paymentcontent = paymentcontent &amp; "&lt;/table&gt;" &amp; 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 &amp; sOrderID &amp; Spaymoney &amp; Spaymentkey &amp; 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 &amp; spstate &amp; Spaymoney &amp; Smoneytype &amp; 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
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.