对于成功创建的以下付款:
res = requests.post(
"https://svcs{}.paypal.com/AdaptivePayments/Pay/".format("" if settings.STAGE == "production" else ".sandbox"),
headers=headers, data=params
)
data = res.json()
我如何获得TransactionID
,我需要将其保存在我的数据库中?
答案 0 :(得分:0)
您可以通过致电TransactionID
-
/AdaptivePayments/PaymentDetails/
params = OrderedDict()
params['requestEnvelope.errorLanguage'] = 'en_US'
params['payKey'] = pay_key
res = requests.post('https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails/', headers=headers, data=params)
transaction_id = res.json()['paymentInfoList']['paymentInfo'][0]['senderTransactionId']
以下是文档:https://developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/