【问题标题】:How to make a TransactionSearch call to Paypal API using Python如何使用 Python 对 Paypal API 进行 TransactionSearch 调用
【发布时间】:2023-03-18 06:32:01
【问题描述】:

我有必要的身份验证详细信息,并且正在尝试执行 TransactionSearch。我不断收到错误消息: ACK=失败&L_ERRORCODE0=81002&L_SHORTMESSAGE0=Unspecified%20Method&L_LONGMESSAGE0=Method%20Specified%20is%20not%20Supported&L_SEVERITYCODE0=错误

这是我的代码:

(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 is used to generate the timestamp and 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()

我做错了什么。

【问题讨论】:

    标签: python paypal paypal-sandbox


    【解决方案1】:

    对于商家 nvp API,使用 urllib.urlencode 而不是 simplejson.dumps

    req= urllib2.Request("https://api-3t.sandbox.paypal.com/nvp", urllib.urlencode(data), headers)
    

    【讨论】:

      猜你喜欢
      • 2013-05-30
      • 2014-06-06
      • 2011-06-09
      • 2013-04-25
      • 2012-07-23
      • 1970-01-01
      • 2013-10-18
      • 2012-05-30
      • 2014-04-26
      相关资源
      最近更新 更多