Created
May 10, 2012 14:49
-
-
Save elialbert/2653649 to your computer and use it in GitHub Desktop.
addpaymentcard trouble
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_card(): | |
test_email='[email protected]' | |
headers = {"X-PAYPAL-SECURITY-USERID":PAYPAL_API_USERNAME,"X-PAYPAL-SECURITY-PASSWORD":PAYPAL_API_PASSWORD,"X-PAYPAL-SECURITY-SIGNATURE":PAYPAL_API_SIGNATURE,"X-PAYPAL-APPLICATION-ID":"APP-80W284485P519543T","X-PAYPAL-REQUEST-DATA-FORMAT":"NV","X-PAYPAL-RESPONSE-DATA-FORMAT":"JSON"} | |
payload = { | |
'requestEnvelope.errorLanguage':'en_US', | |
'emailAddress':test_email, | |
'cardNumber':'5178054152614319', | |
'cardType':'MasterCard', | |
'confirmationType':'WEB', | |
'nameOnCard.firstName':'john', | |
'nameOnCard.lastName':'smith', | |
'billingAddress.line1':'1443 chicago ave', | |
'billingAddress.city':'Chicago', | |
'billingAddress.state':'IL', | |
'billingAddress.postalCode':'60660', | |
'billingAddress.countryCode':'US', | |
'expirationDate.year':'2014', | |
'expirationDate.month':'6', | |
} | |
payload = urllib.urlencode(payload) | |
print payload | |
resp = requests.post('https://svcs.sandbox.paypal.com/AdaptiveAccounts/AddPaymentCard',headers=headers,data=payload) | |
print resp.status_code | |
print resp.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
response is:
{"responseEnvelope":{"timestamp":"2012-05-10T07:47:32.802-07:00","ack":"Failure","correlationId":"2ab6eaaa830c4","build":"2810423"},"error":[{"errorId":"580029","domain":"PLATFORM","subdomain":"Application","severity":"Error","category":"Application","message":"Missing required request parameter: null","parameter":["null"]}]}