PayPal支付接口参数

这两天一直在弄PayPal支付接口
注册PayPal,进放商家工具,开启返回数据后得到一个KEY,这是用来作数据查询时的KEY
PayPal支持支付完成后数据的返回,以URL形式传递给你一组变量,你再结合KEY来POST请求得到返回的数据
支付提交页

在登陆帐号支付后,PayPal转到事先设定好的返回页面,接收参数,重新POST请求数据,取得支付信息
<%@LANGUAGE="VBScript"%> <% Dim authToken, txToken Dim query Dim objHttp Dim sQuerystring Dim sParts, iParts, aParts Dim sResults, sKey, sValue Dim i, result Dim firstName, lastName, itemName, mcGross, mcCurrency authToken = "Dc7P6f0ZadXW-U1X8oxf8_vUK09EHBMD7_53IiTT-CfTpfzkN0nipFKUPYy" txToken = Request.Querystring("tx") query = "cmd=_notify-synch&tx=" & txToken & "&at=" & authToken set objHttp = Server.CreateObject("Microsoft.XMLHTTP") ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") objHttp.open "POST", "http://www.paypal.com/cgi-bin/webscr", false objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded" objHttp.Send query sQuerystring = objHttp.responseText If Mid(sQuerystring,1,7) = "SUCCESS" Then sQuerystring = Mid(sQuerystring,9) sParts = Split(sQuerystring, vbLf) iParts = UBound(sParts) - 1 ReDim sResults(iParts, 1) For i = 0 To iParts aParts = Split(sParts(i), "=") sKey = aParts(0) sValue = aParts(1) sResults(i, 0) = sKey sResults(i, 1) = sValue Select Case sKey Case "first_name" firstName = sValue Case "last_name" lastName = sValue Case "item_name" itemName = sValue Case "mc_gross" mcGross = sValue Case "mc_currency" mcCurrency = sValue End Select Next Response.Write("

Your order has been received.

") Response.Write("Details
") Response.Write("
  • Name: " & firstName & " " & lastName & "
  • ") Response.Write("
  • Description: " & itemName & "
  • ") Response.Write("
  • Amount: " & mcCurrency & " " & mcGross & "
  • ") Response.Write("
    ") Else 'log for manual investigation Response.Write("ERROR") End If %>
    得到的数据是这样的结构,注,此数据是要保留一段时间的
    SUCCESS mc_gross=100.00 address_status=confirmed payer_id=H9ZU7AU5Y864A tax=0.00 address_street=1+Main+St payment_date=22%3A40%3A18+Jul+22%2C+2007+PDT payment_status=Completed charset=windows-1252 address_zip=95131 first_name=Test mc_fee=3.20 address_country_code=US address_name=Test+User custom= payer_status=verified business=hubro__1185162468_biz%40hotmail.com address_country=United+States address_city=San+Jose quantity=1 payer_email=hubro__1185162439_per%40hotmail.com txn_id=615339376J321152L payment_type=instant last_name=User address_state=CA receiver_email=hubro__1185162468_biz%40hotmail.com payment_fee=3.20 receiver_id=456JSSWY3CPQA txn_type=web_accept item_name=%1A%1A%1A%1A mc_currency=USD item_number=00001 residence_country=US payment_gross=100.00 shipping=0.00
    PayPal还提供了开发环境测试,SandBox 
     

    你可能感兴趣的:(PayPal支付接口参数)