0

I'm writing an application that utilizes Paypal's permissions API. I'm currently working on the sandbox. I get the verification code correctly but when I try to GetAccessToken, I get the error:

{"responseEnvelope":{"timestamp":"2013-09-03T08:32:16.580-07:00","ack":"Failure","correlationId":"3527b7033f20f","build":"2210301"},"error":[{"errorId":"560022","domain":"PLATFORM","subdomain":"Application","severity":"Error","category":"Application","message":"The X-PAYPAL-APPLICATION-ID header contains an invalid value","parameter":["X-PAYPAL-APPLICATION-ID"]}]}

I'm using the sandbox APP_ID and all the Verification code is also gotten dynamically. Here is my code fragment.

token = "AAAAAAAYaraTSVjvkUBT"
verification = "mgnnWDVfFmgAES0q371Hug"
headers2 = {
"X-PAYPAL-SECURITY-USERID": settings.USERNAME,
"X-PAYPAL-SECURITY-PASSWORD": settings.PASSWORD,
"X-PAYPAL-SECURITY-SIGNATURE": settings.SIGNATURE,
"X-PAYPAL-REQUEST-DATA-FORMAT": "JSON",
"X-PAYPAL-RESPONSE-DATA-FORMAT": "JSON",
"X-PAYPAL-APPLICATION-ID": "APP-80W284485P519543T",
}
url = "https://svcs.paypal.com/Permissions/GetAccessToken/?token=%s&verifier=%s" %(token, verification)
dat2 = {"requestEnvelope": {"errorLanguage":"en_US"}}
req2 = urllib2.Request(url, simplejson.dumps(dat2), headers2)
res2 = urllib2.urlopen(req2).read()  

What I'm I doing wrong??

4

2 回答 2

1

您不能在实时环境中使用沙盒应用程序 ID。请参阅https://developer.paypal.com/webapps/developer/docs/classic/lifecycle/goingLive/#register了解如何获取实时应用程序 ID。

于 2013-09-03T17:08:40.983 回答
0

正如上面 Siddick 所说,端点应该是https://svcs.sandbox.paypal.com 。贝宝 API 文档是如此不一致,我之前使用的端点在文档中被用于沙箱情况。

于 2013-09-04T06:53:14.087 回答