我在实施paypal隐式付款时遇到一些困难,不幸的是,paypal的错误消息响应中的细节非常有限。
这是请求:
{
"actionType": "PAY",
"currencyCode": "USD",
"cancelUrl": "http://my_domain.com/cancel_url",
"returnUrl": "http://my_domain.com/return_url",
"requestEnvelope.errorLanguage": "en_US",
"requestEnvelope.detailLevel": "ReturnAll",
"senderEmail": "sender@email.com",
"receiverList.receiver(0).amount": 50,
"receiverList.receiver(0).email": "receiver@email.com"
}
这是我正在设置的标题:
"Content-Type", "application/json"
"Accept-Language", "en_US"
"X-PAYPAL-SECURITY-USERID", "username"
"X-PAYPAL-SECURITY-PASSWORD", "pwd"
"X-PAYPAL-SECURITY-SIGNATURE", "sig"
"X-PAYPAL-APPLICATION-ID", "My App id"
"X-PAYPAL-REQUEST-DATA-FORMAT", "JSON"
"X-PAYPAL-RESPONSE-DATA-FORMAT", "JSON"
以下是回复:
{
"responseEnvelope":{
"timestamp":"2013-04-06T12:02:41.011-07:00",
"ack":"Failure",
"correlationId":"3842d361b077d",
"build":"5563463"},"error":[{
"errorId":"580001",
"domain":"PLATFORM",
"subdomain":"Application",
"severity":"Error",
"category":"Application",
"message":"Invalid request: {0}"
}]
}
答案 0 :(得分:2)
我遇到了完全相同的问题,无法在任何地方找到答案。事实证明我使用的是GET请求而不是POST。虽然在他们的文档中找不到errorId 580001,但这很奇怪。
答案 1 :(得分:0)
自适应支付API不接受请求有效负载中的空格,删除所有空格和换行符并再次尝试。花了我很多年才弄明白。
答案 2 :(得分:0)
要注意的另一件事是编码。我有这个错误,并意识到这是由于"备忘录"领域。如果您将请求作为NVP发送,请务必尽可能进行URL编码。
答案 3 :(得分:0)
let payload={
"actionType":"PAY",
"currencyCode":"USD",
"receiverList":{
"receiver":[{
"amount":1.00,
"email":"buyer email"
}]
},
"returnUrl":"succes url",
"cancelUrl":"cancel url",
"requestEnvelope":{
"errorLanguage":"en_US",
"detailLevel":"ReturnAll"
}
}
let url = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay";
return this.http.post(url, payload, { headers: headers })
headers.append('X-PAYPAL-SECURITY-USERID', 'security id');
headers.append('X-PAYPAL-SECURITY-PASSWORD', 'password');
headers.append('X-PAYPAL-SECURITY-SIGNATURE', 'signature');
headers.append('X-PAYPAL-REQUEST-DATA-FORMAT', 'JSON');
headers.append('X-PAYPAL-RESPONSE-DATA-FORMAT', 'JSON');
headers.append('X-PAYPAL-APPLICATION-ID', 'APP-id');
答案 4 :(得分:0)
作为此问题的另一个原因,请确保每个接收器的amount
属性不包含逗号,因为这也会中断。即1000.00
代替1,000.00
。