我正在尝试在 bash 代码中编写部分退款PayPal交易。这是我遵循的指南 https://developer.paypal.com/docs/classic/api/adaptive-payments/Refund_API_Operation/但我收到520002错误消息。在以前的请求中,我已经看到需要指定receiverList.receiver(0).email
但它仍然不起作用。这是我的请求的样子:
curl -s --insecure
-H "X-PAYPAL-SECURITY-USERID: api_username"
-H "X-PAYPAL-SECURITY-PASSWORD: api_password"
-H "X-PAYPAL-SECURITY-SIGNATURE: api_signature"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
-H "X-PAYPAL-APPLICATION-ID: your_app_id "
https://svcs.sandbox.paypal.com/AdaptivePayments/Refund -d
"requestEnvelope.errorLanguage=en_US
&requestEnvelope.detailLevel=ReturnAll
&transactionId=xxxxxxxxxx
&receiverList.receiver(0).email=xxxxxxxx
¤cyCode=EUR
&receiverList.receiver(0).amount=44.00"
有人知道如何解决它吗?
我认为您为此使用了错误的API。您的端点转到自适应支付API,该API用于非常具体的业务案例,并且实施起来非常复杂。
如果您想从使用快速结账或PayPal标准PayPal付款进行简单退款,则应使用 RefundTransaction API 调用。https://developer.paypal.com/docs/classic/express-checkout/ht_basicRefund-curl-etc/
您的 CURL 调用应该是这样的:
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=RefundTransaction
&VERSION=94
&TRANSACTIONID=transaction_ID #ID of the transaction for which the refund is made
&REFUNDTYPE=Full #Specifies a full refund; a partial refund requires more input fields