Python 我在哪里可以获得执行付款的付款人id(paypal)?
使用PayPal Python REST SDK。创建付款后,我们需要执行此付款。At是代码示例。但在执行付款时Python 我在哪里可以获得执行付款的付款人id(paypal)?,python,django,rest,paypal,payment,Python,Django,Rest,Paypal,Payment,使用PayPal Python REST SDK。创建付款后,我们需要执行此付款。At是代码示例。但在执行付款时 if payment.execute({"payer_id": "DUFRQ8GWYMJXC"}): # return True or False print("Payment[%s] execute successfully" % (payment.id)) else: print(payment.error) 我们需要写付款人身份证,但我怎么能接受呢?有什么想法或代码
if payment.execute({"payer_id": "DUFRQ8GWYMJXC"}): # return True or False
print("Payment[%s] execute successfully" % (payment.id))
else:
print(payment.error)
我们需要写付款人身份证,但我怎么能接受呢?有什么想法或代码示例吗?payerid将在回调的主机头中返回-或者,您可以执行以下操作 在创建销售的过程中,是否
saleinfo_ = {"intent":"sale",
"redirect_urls":{
"return_url":("myurlonsuccess"),
"cancel_url":("myurlonfail")
},
"payer":{"payment_method":"paypal"},
"transactions":[
{"amount":{"total":out_totaltopay_, "details":{"tax":out_taxes_, "subtotal":out_subtotal_}, "currency":symbol_}, "description":description_}
payment_ = Payment(saleinfo_)
if (payment_.create()):
token_ = payment_.id
然后,当返回回调到达时,使用
payment_ = Payment.find(token_)
if (payment_ != None):
payerid_ = payment_.payer.payer_info.payer_id
if (payment_.execute({"payer_id":payerid_})):
....
在查找过程中接收到的json数据类似于以下内容
{'payment_method': 'paypal', 'status': 'VERIFIED', 'payer_info': {'shipping_address': {'line1': '1 Main St', 'recipient_name': 'Test Buyer', 'country_code': 'US', 'state': 'CA', 'postal_code': '95131', 'city': 'San Jose'}, 'first_name': 'Test', 'payer_id': '<<SOMEID>>', 'country_code': 'US', 'email': 'testbuyer@mydomain.com', 'last_name': 'Buyer'}}
{'payment_method':'paypal','status':'VERIFIED','payer_info':{'shipping_address':{'line1':'Main St St','recipient_name':'Test Buyer','country_code':'US','state':'CA','posal_code':'95131','city','San Jose','first_name':'Test','payer_id':'testbuyer@mydomain.com“,”姓“:”买方“}”
希望有帮助