在实时模式下调用DoCapture时,10002安全标头无效错误

时间:2014-02-19 09:25:44

标签: paypal

我需要一些有关Paypal快速结账的帮助。这是我的情况 - 我可以做:SetExpressCheckout,DoExpressCheckout成功 - 但我无法使用DoCapture来获取授权金额。这是错误“10002安全标头无效”。注意到这只发生在实时模式,它在沙盒模式下工作正常。

请帮忙。谢谢Thanh

1 个答案:

答案 0 :(得分:0)

执行 DoExpressCheckoutPayment 后获取授权ID并在DoCapture中使用

Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=DoExpressCheckoutPayment
&VERSION=95
&TOKEN=EC-470284976K7901234    #Token from the SetExpressCheckout response
&PAYERID=3TXTXECKFU1234    #Customer account ID, from the GetExpressCheckoutDetails response
&PAYMENTREQUEST_0_PAYMENTACTION=Authorization    #Enables you to collect payment in the future
&PAYMENTREQUEST_0_AMT=1
&PAYMENTREQUEST_0_CURRENCYCODE=USD

响应

--------
TOKEN=EC%2d470284976K7901234
&ACK=Success
&VERSION=95
&PAYMENTINFO_0_TRANSACTIONID=20K92515TX2901234    #Use this value as the authorization ID in a DoCapture request
&PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=QJSRDC4JW1234
&PAYMENTINFO_0_ACK=Success

...

DoCapture 致电

请求

Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=DoCapture
&VERSION=95
&AUTHORIZATIONID=20K92515TX2901234    #Authorization ID. Specify the value of PAYMENTINFO_0_TRANSACTIONID from the DoExpressCheckoutPayment response)
&AMT=1    #The amount of the payment
&CURRENCYCODE=USD
&COMPLETETYPE=Complete    #Indicates that for the authorization specified, this is the last payment capture 

响应

AUTHORIZATIONID=20K92515TX2901234
&ACK=Success
&TRANSACTIONID=2KF46316MJ7751234    #New transaction ID for this payment
&PARENTTRANSACTIONID=20K92515TX2901234    #Same as the ID of the original authorization
&TRANSACTIONTYPE=expresscheckout
&PAYMENTTYPE=instant
&AMT=1%2e00
&FEEAMT=0%2e33
&TAXAMT=0%2e00
&CURRENCYCODE=USD
&PAYMENTSTATUS=Completed
...

参考https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleAuthPayment-curl-etc/