Paypal ASP经典贝宝集成流程及问题

Paypal ASP经典贝宝集成流程及问题,paypal,asp-classic,integration,Paypal,Asp Classic,Integration,我需要一些关于贝宝整合的清晰。 首先,我已经做了一个成功的经典ASP贝宝集成大约三年前,工作刚刚好。 我将其与当前的Paypal文档结合使用,为客户开发了一个新系统。我不能让它工作 以下是我正在做的: 步骤1:我有一篮子物品(在本例中,是展示票) 步骤2:我以自己的形式捕获用户地址和联系方式 步骤3:我调用从Paypal开发者API下载的“expresscheckout.asp”表单 以下是该表单上的第一位代码: <% v_title = Request.Form("ti

我需要一些关于贝宝整合的清晰。 首先,我已经做了一个成功的经典ASP贝宝集成大约三年前,工作刚刚好。 我将其与当前的Paypal文档结合使用,为客户开发了一个新系统。我不能让它工作

以下是我正在做的:

步骤1:我有一篮子物品(在本例中,是展示票)

步骤2:我以自己的形式捕获用户地址和联系方式

步骤3:我调用从Paypal开发者API下载的“expresscheckout.asp”表单

以下是该表单上的第一位代码:

 <%
 v_title        = Request.Form("title")
 v_firstname    = Request.Form("firstname")
 v_lastname     = Request.Form("lastname")
 v_addrline1    = Request.Form("addrline1")
 v_addrline2    = Request.Form("addrline2")
 v_addrline3    = Request.Form("addrline3")
 v_addrline4    = Request.Form("addrline4")
 v_addrcity     = Request.Form("addrcity")
 v_addrcounty   = Request.Form("addrcounty")
 v_addrpostcode = Request.Form("addrpostcode")
 v_countryid    = Request.Form("countryid")
 v_currencyid   = Request.Form("currencyid")
 v_phoneprimary = Request.Form("phoneprimary")
 v_email        = Request.Form("email")

 SQLStmt = "UPDATE [OrderHeader] SET [Title] = '" & v_title & "',[FirstName] = '" & v_firstname & "',[LastName] = '" & v_lastname & "',[AddrLine1] = '" & v_addrline1 & "',[AddrLine2] = '" & v_addrline2 & "',[AddrLine3] = '" & v_addrline3 & "',[AddrLine4] = '" & v_addrline4 & "',[AddrCity] = '" & v_addrcity & "',[AddrCounty] = '" & v_addrcounty & "',AddrPostcode='" & v_addrpostcode & "',CountryId=" & v_countryid & ",CurrencyId=" & v_currencyid & ",PhonePrimary='" & v_phoneprimary & "',Email='" & v_email & "', Status='New' WHERE [OrderReference] = '" & session("orderreference") & "';"
 Set RS_OrderHeader01 = Connection01.Execute(SQLStmt)

On Error Resume Next
paymentAmount = Session("Payment_Amount")
currencyCodeType = "GBP"
paymentType = "Sale"
returnURL = "http://www.myurl.co.uk/transactioncomplete.asp"
cancelURL = "http://www.myurl.co.uk/shop.asp"

%>

正如您所见,我正在捕获我的用户输入详细信息,更新我的OrderHeader,然后设置Paypal变量。我可以确认“paymentAmount”设置正确

同一表格的下一部分代码为:

<%
Set resArray = CallShortcutExpressCheckout (paymentAmount, currencyCodeType, paymentType, returnURL, cancelURL)

ack = UCase(resArray("ACK"))
If ack="SUCCESS" Then
 ' Redirect to paypal.com
 SQLStmt = "UPDATE [OrderHeader] SET [Token] = '" & resArray("TOKEN") & "' WHERE [OrderReference] = '" & session("orderreference") & "';"
 Set RS_OrderHeader01 = Connection01.Execute(SQLStmt)
 ReDirectURL(resArray("TOKEN") )
Else
 'Display a user friendly Error on the page using any of the following error information returned by PayPal
 ErrorCode = URLDecode( resArray("L_ERRORCODE0"))
 ErrorShortMsg = URLDecode( resArray("L_SHORTMESSAGE0"))
 ErrorLongMsg = URLDecode( resArray("L_LONGMESSAGE0"))
 ErrorSeverityCode = URLDecode( resArray("L_SEVERITYCODE0"))
%>
   <div class="content full left">
    <h1>Payment Not Succesful</h1>
    <p>Your order number is &nbsp;<span class="bold"><%=session("orderreference")%></span>. Please use this number if you need to contact us about this order.
   </div>
   <div class="content full left">
    <h2>There was a problem with your payment.</h2>
    <p>Please contact us with your order reference and following details so that we can help you complete the transaction.</p>
    <p>Paypal error code: <%=ErrorCode%></p>
    <p>Error description: <%=ErrorLongMsg%></p>
    <p>Severity: <%=ErrorSeverityCode%></p>
   </div>
<%
End If
%>

付款不成功
您的订单号是。如果您需要就此订单与我们联系,请使用此号码。
你的付款有问题。
请与我们联系,提供您的订单参考和以下详细信息,以便我们帮助您完成交易

Paypal错误代码:

错误说明:

严重性:

从中可以看出,我正在调用“CallShortcutExpressCheckout”。我可以确认令牌已正确返回,并用它更新我的Orderheader

到目前为止,一切顺利

然而,此时我被重定向到一个Payal页面,该页面有一个空白的订单摘要。 一旦我输入我的沙盒买家帐户详细信息,我就会被发送到我的ReturnURL

我的返回URL上的代码如下:

<%
 Session("orderreference") = ""
 On Error Resume Next
 finalPaymentAmount = Session("Payment_Amount")
 set resArray = GetShippingDetails( Request.QueryString("token"))
 set resArray = ConfirmPayment( finalPaymentAmount )

 ack = UCase(resArray("ACK"))

 If ack <> "SUCCESS" Then
  'Display a user friendly Error on the page using any of the following error information returned by PayPal
  ErrorCode = URLDecode( resArray("L_ERRORCODE0"))
  ErrorShortMsg = URLDecode( resArray("L_SHORTMESSAGE0"))
  ErrorLongMsg = URLDecode( resArray("L_LONGMESSAGE0"))
  ErrorSeverityCode = URLDecode( resArray("L_SEVERITYCODE0"))

response.Write("ack = " & ack)
response.Write("ErrorCode = " & ErrorCode)


 Else
  token = resArray("TOKEN") 
  transactionId = resArray("PAYMENTINFO_0_TRANSACTIONID") 
  transactionType = resArray("PAYMENTINFO_0_TRANSACTIONTYPE") 
  paymentType = resArray("PAYMENTINFO_0_PAYMENTTYPE")
  orderTime = resArray("PAYMENTINFO_0_ORDERTIME")
  amt    = resArray("PAYMENTINFO_0_AMT")
  currencyCode = resArray("PAYMENTINFO_0_CURRENCYCODE")
  taxAmt   = resArray("PAYMENTINFO_0_TAXAMT")
  paymentStatus = resArray("PAYMENTINFO_0_PAYMENTSTATUS")
  pendingReason = resArray("PAYMENTINFO_0_PENDINGREASON")
  reasonCode  = resArray("PAYMENTINFO_0_REASONCODE")

  SQLStmt = "UPDATE [OrderHeader] SET [Status]='Success' WHERE [Token] = '" & token & "';"
  Set RS_OrderHeader01 = Connection01.Execute(SQLStmt)

  SQLStmt = "SELECT * FROM [OrderHeader] WHERE [Token] = '" & token & "';"
  Set RS_OrderHeader02 = Connection01.Execute(SQLStmt)
 End If
%>

如果您在错误时删除,请继续下一步,您会看到什么错误?还有一件事要做的是尝试使用URLDecode(resArray而不是URLDecode)(resArray,如果您将字符串值(5)而不是整数或货币(5)传递给它,您认为resArray会如何反应。这是您试图从数组中检索ack值的奇怪尝试的基础。您刚刚将数组重置为一个货币值。设置不带索引的数组将将数组重置为您运行的最后一个值,并将索引设置为0。