2
我正在向paypal自適應付款API發出PAY請求,並得到一個沒有附加信息的通用錯誤ID 580001。自適應付款付款API錯誤580001
headers = {
# API credentials for the API caller business account
'X-PAYPAL-SECURITY-USERID': config.PAYPAL_API_USER_ID,
'X-PAYPAL-SECURITY-PASSWORD': config.PAYPAL_API_PASSWORD,
'X-PAYPAL-SECURITY-SIGNATURE': config.PAYPAL_API_SIGNATURE,
'X-PAYPAL-APPLICATION-ID': 'APP-80W284485P519543T',
'X-PAYPAL-REQUEST-DATA-FORMAT': 'JSON',
'X-PAYPAL-RESPONSE-DATA-FORMAT': 'JSON'
}
payload = {
"actionType": "PAY",
"currencyCode": "USD",
"receiverList": {
"receiver": [{
"amount": "1.00",
"email": "[email protected]"
}]
},
# where the sender is redirected
"returnUrl": config.SUCCESS_URL,
"cancelUrl": config.SUCCESS_URL,
"requestEnvelope": {
"errorLanguage":"en_US",
# error detail level
"detailLevel":"ReturnAll"
}
}
import urllib2, urllib
payload = urllib.urlencode(payload)
request = urllib2.Request(url='https://svcs.sandbox.paypal.com/AdaptivePayments/Pay',
data=payload,
headers=headers)
f = urllib2.urlopen(request)
contents = f.read()
響應:
{"responseEnvelope":
{"timestamp":"2013-08-22T15:44:50.97507:00",
"ack":"Failure",
"correlationId":"df4f39293971f",
"build":"6941298"
},
"error"[ {"errorId":"580001",
"domain":"PLATFORM",
"subdomain":"Application",
"severity":"Error",
"category":"Application",
"message":"Invalid request: {0}"}
]
}
冰壺與我的憑據作品,它只是通過urrllib多數民衆贊成失敗下去。我使用相同的錯誤代碼讀取了其他人錯誤地發送了HTTP GET,我通過request.get_method()確認了這確實是POSTing。有任何想法嗎?
你可以發佈整個python腳本以及工作curl命令嗎? – Dennis
感謝丹尼斯,我在下面發佈了答案。 – sara