0

我的结帐流程需要多个授权和捕获,如https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECRelatedAPIOps/#authorization-payment-action-for-express-checkout中所述

我需要进行单独的身份验证和捕获,因为订单包含可能单独发货的多个项目。

首先,我SetExpressCheckout使用Authorization.

cancelUrl=xxxxxxx&
PAYMENTREQUEST_0_PAYMENTACTION=Authorization&
PAYMENTREQUEST_0_CURRENCYCODE=USD&
L_BILLINGAGREEMENTDESCRIPTION0=ClubUsage&
VERSION=204&
PAYMENTREQUEST_0_AMT=30.00&
L_BILLINGTYPE0=MerchantInitiatedBilling&
METHOD=SetExpressCheckout&
USER=xxxxxxx&
PWD=xxxxxxx&
returnUrl=xxxxxxx&
SIGNATURE=xxxxxxx

我收到带有令牌的响应;

TOKEN=EC-2EP3671xxxxxxxx&
TIMESTAMP=xxxxxxx&
CORRELATIONID=xxxxxxx&
ACK=Success&
VERSION=204&
BUILD=xxxxxxx

接下来,我将用户重定向到贝宝登录并同意。当他们回来时,我打电话来创建一个计费协议,因为我将在以后进行参考交易。这工作正常。接下来我进行第一次身份验证调用;

PAYMENTREQUEST_0_PAYMENTACTION=Authorization&
PAYMENTREQUEST_0_PAYMENTREQUESTID=200001&
PAYERID=xxxxxxx&
VERSION=204&
PAYMENTREQUEST_0_AMT=25.00&
METHOD=DoExpressCheckoutPayment&
USER=xxxxxxx&
PWD=xxxxxxx&
SIGNATURE=xxxxxxx&
TOKEN=EC-2EP3671xxxxxxx

我得到了成功的回应;

TOKEN=EC-2EP3671xxxxxxx&
SUCCESSPAGEREDIRECTREQUESTED=false&
TIMESTAMP=xxxxxxx&
CORRELATIONID=xxxxxxx&
ACK=Success&
VERSION=204&
BUILD=26126731&
INSURANCEOPTIONSELECTED=false&
SHIPPINGOPTIONISDEFAULT=false&
PAYMENTINFO_0_TRANSACTIONID=0J23486xxxxxxx&
PAYMENTINFO_0_TRANSACTIONTYPE=expresscheckout&
PAYMENTINFO_0_PAYMENTTYPE=instant&
PAYMENTINFO_0_ORDERTIME=xxxxxxx&
PAYMENTINFO_0_AMT=25.00&
PAYMENTINFO_0_TAXAMT=0.00&
PAYMENTINFO_0_CURRENCYCODE=USD&
PAYMENTINFO_0_PAYMENTSTATUS=Pending&
PAYMENTINFO_0_PENDINGREASON=authorization&
PAYMENTINFO_0_REASONCODE=None&
PAYMENTINFO_0_PROTECTIONELIGIBILITY=Eligible&
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE=ItemNotReceivedEligible,UnauthorizedPaymentEligible&
PAYMENTINFO_0_SELLERPAYPALACCOUNTID=xxxxxxx&
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=xxxxxxx&
PAYMENTINFO_0_PAYMENTREQUESTID=200001&
PAYMENTINFO_0_ERRORCODE=0&
PAYMENTINFO_0_ACK=Success

到目前为止一切都很好。但我现在需要进行第二次身份验证;

PAYMENTREQUEST_0_PAYMENTACTION=Authorization&
PAYMENTREQUEST_0_PAYMENTREQUESTID=200002&
PAYERID=xxxxxxx&
VERSION=204&
PAYMENTREQUEST_0_AMT=5.00&
METHOD=DoExpressCheckoutPayment&
USER=xxxxxxx&
PWD=xxxxxxx&
SIGNATURE=xxxxxxx&
TOKEN=EC-2EP3671xxxxxxx

..但不是执行身份验证,PayPal 似乎认为它是第一个身份验证的副本;

TOKEN=EC-2EP3671xxxxxxx&
SUCCESSPAGEREDIRECTREQUESTED=false&
TIMESTAMP=xxxxxxx&
CORRELATIONID=xxxxxxx&
ACK=SuccessWithWarning&
VERSION=204&
BUILD=26126731&
L_ERRORCODE0=11607&
L_SHORTMESSAGE0=Duplicate Request&
L_LONGMESSAGE0=A successful transaction has already been completed for this token.&
L_SEVERITYCODE0=Warning&
INSURANCEOPTIONSELECTED=false&
SHIPPINGOPTIONISDEFAULT=false&
PAYMENTINFO_0_TRANSACTIONID=0J23486xxxxxxx&
PAYMENTINFO_0_TRANSACTIONTYPE=expresscheckout&
PAYMENTINFO_0_PAYMENTTYPE=instant&
PAYMENTINFO_0_ORDERTIME=xxxxxxx&
PAYMENTINFO_0_AMT=25.00&
PAYMENTINFO_0_TAXAMT=0.00&
PAYMENTINFO_0_CURRENCYCODE=USD&
PAYMENTINFO_0_PAYMENTSTATUS=Pending&
PAYMENTINFO_0_PENDINGREASON=authorization&
PAYMENTINFO_0_REASONCODE=None&
PAYMENTINFO_0_PROTECTIONELIGIBILITY=Eligible&
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE=ItemNotReceivedEligible,UnauthorizedPaymentEligible&
PAYMENTINFO_0_SELLERPAYPALACCOUNTID=xxxxxxx&
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=xxxxxxx&
PAYMENTINFO_0_PAYMENTREQUESTID=200001&
PAYMENTINFO_0_ERRORCODE=0&
PAYMENTINFO_0_ACK=Success

交易 id 和金额与对第一个身份验证的响应中的相同。我如何在没有 PayPal 认为它们重复相同的情况下进行多次授权?我对流程的理解不正确吗?如果是这样,什么必要的流程?

4

1 回答 1

1

您不能使用同一个令牌多次调用 DoExpressCheckoutPayment。您必须使用 SetExpressCheckout 再次启动整个流程才能获得新令牌。

但是,实际上,听起来您所追求的是“订单”。不要使用授权支付操作,而是使用订单。使用 PayPal 完成“订单”后,您可以使用 DoAuthorization 和 DoCapture 运行多个身份验证和捕获。

有关更多详细信息,请参阅 PayPal 的文档以了解如何使用 Express Checkout 创建和处理订单

您对计费协议所做的操作将用于参考交易。如果用户通过您设置的计费协议的授权,您可以随时运行 DoReferenceTransaction 来处理您需要的任何金额,而无需进一步批准。这通常用于“自动发货”系统或“一键结帐”类型的系统,其中保存了个人的帐单信息,因此他们每次向您订购时都不必再次输入。如果需要,您还可以使用此方法构建定期支付系统。

根据您所说的,听起来您不需要计费协议。您只需要执行快速结帐订单。

于 2016-10-27T22:45:54.803 回答