0

PayPal Invoicing API文档中的示例调用返回错误?

要求

curl -s --insecure -H "X-PAYPAL-SECURITY-USERID: caller_1312486258_biz_api1.gmail.com" -H "X-PAYPAL-SECURITY-PASSWORD: 1312486294" -H "X-PAYPAL-SECURITY-SIGNATURE: AbtI7HV1xB428VygBUcIhARzxch4AL65.T18CTeylixNNxDZUu0iO87e" -H "X-PAYPAL-REQUEST-DATA-FORMAT: JSON" -H "X-PAYPAL-RESPONSE-DATA-FORMAT: JSON" -H "X-PAYPAL-APPLICATION-ID:APP-80W284485P519543T" https://svcs.sandbox.paypal.com/Invoice/CreateAndSendInvoice -d {\"requestEnvelope\":{\"errorLanguage\":\"en_US\"},\"invoice\":{\"merchantEmail\":\"caller_1335455804_biz@x.com\",\"payerEmail\":\"sender_1335455648_per@x.com\",\"currencyCode\":\"USD\",\"paymentTerms\":\"DueOnReceipt\",\"itemList\":{\"item\":[{\"name\":\"BananaPlant\",\"quantity\":\"1\",\"unitPrice\":\"38.95\"},{\"name\":\"PeachTree\",\"quantity\":\"2\",\"unitPrice\":\"14.95\"}]}}}

回复

{"responseEnvelope":{"timestamp":"2013-08-22T23:58:47.340-07:00","ack":"Failure","correlationId":"4838886d6636b","build":"7236486"},"error":[{"errorId":"580001","domain":"PLATFORM","subdomain":"Application","severity":"Error","category":"Application","message":"Invalid request: {0}"}]}
4

1 回答 1

0

尝试将有效负载包装在“”内的 -d 开关中。使用 -v 开关按原样运行 curl 片段将显示有效负载被截断,因此出现“无效请求”错误。

此外,当请求中的商家邮箱与 API 调用方不同时,您会看到“无效令牌”错误。如果您需要代表第三方生成发票(在这种情况下,API 调用者和商家电子邮件自然不同),您必须获得第三方权限并在您的请求中附加 X-PAYPAL-AUTHORIZATION 标头。

于 2013-08-29T10:31:44.953 回答