Skip to content

Instantly share code, notes, and snippets.

@elialbert
Created May 10, 2012 14:49
Show Gist options
  • Save elialbert/2653649 to your computer and use it in GitHub Desktop.
Save elialbert/2653649 to your computer and use it in GitHub Desktop.
addpaymentcard trouble
def set_card():
test_email='eli_1335983746_per@simplerelevance.com'
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
@elialbert
Copy link
Author

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"]}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment