How to make a TransactionSearch call to Paypal API using Python -
i have necessary authentication details , i'm trying transactionsearch. keep getting error: ack=failure&l_errorcode0=81002&l_shortmessage0=unspecified%20method&l_longmessage0=method%20specified%20is%20not%20supported&l_severitycode0=error
here code:
(timestamp, signature) = signaturegen.getauthheader(apiuser=settings.username, apipass=settings.password, accesstok=res2["token"], sectok=res2["tokensecret"], httpmethod="post", scripturi="https://api-3t.sandbox.paypal.com/nvp") #the above operation used generate timestamp , signature headers = {"x-paypal-authorization": "timestamp="+<timestamp>+",token="+<token>+",signature="+<signature>, "subject": settings.<api_username>} data = { "method": "transactionsearch", "startdate": "2012-01-01t05:38:48z", } req= urllib2.request("https://api-3t.sandbox.paypal.com/nvp", simplejson.dumps(data), headers) res = urllib2.urlopen(req).read() what i'm doing wrong.
use urllib.urlencode instead of simplejson.dumps merchant nvp apis.
req= urllib2.request("https://api-3t.sandbox.paypal.com/nvp", urllib.urlencode(data), headers)
Comments
Post a Comment