我正在使用 PayPals API,它的文档记录非常糟糕,需要寻求帮助。
我在 PayPal Adaptive API 上扩展我的网站,它允许我之前设置预先批准的付款。
除了发送的详细信息,我还想添加一些用户信息。
似乎可以根据他们的文档来完成,但在 IPN 中没有任何地方被捕获。
简单支付
def test_pay():
response = paypal.pay(
actionType = 'PAY',
cancelUrl = cancelUrl,
currencyCode = currencyCode,
senderEmail = EMAIL_ACCOUNT,
feesPayer = 'EACHRECEIVER',
memo = 'Simple payment example',
preapprovalKey = 'PA-0HA01893HK6322232',
receiverList = { 'receiver': [
{ 'amount':"10.0", 'email':API_EMAIL, 'primary':True },
{ 'amount':"5.0", 'email':SECONDARY_EMAIL, 'primary':False }
]},
clientDetailsType = { 'customerId': 1, 'customerType': 'Normal' },
returnUrl = returnUrl,
ipnNotificationUrl = notificationUrl
)
# if response['responseEnvelope']['ack'] == "Success":
print response['responseEnvelope']['ack']
# if response['paymentExecStatus'] == "COMPLETED":
print response['paymentExecStatus']
# if response.has_key('payKey'):
print response['payKey']
print response
test_pay()
IPN 响应
pay_key=AP-8J7165865F7541310&transaction%5B0%5D.id_for_sender_txn=4GL2853573576212V&transaction%5B0%5D.pending_reason=NONE&charset=windows-1252&log_default_shipping_address_in_transaction=false&transaction%5B0%5D.id=6XD76450JV9737605¬ify_version=UNVERSIONED&preapproval_key=PA-93P236141R834703C&transaction%5B1%5D.id=9R07347926768733A&test_ipn=1&transaction%5B0%5D.status=Completed&status=COMPLETED&action_type=PAY&memo=Simple+payment+example&transaction%5B0%5D.receiver=a.smit_1329744569_biz%40mac.com&transaction%5B1%5D.status=Completed&payment_request_date=Wed+Feb+22+05%3A30%3A49+PST+2012&transaction%5B1%5D.id_for_sender_txn=2D9633797C888500H&verify_sign=AIDiik4kxSLiNqbMmTDHplFnCnz3A3ORrDVlBVOzrtltyUx-NoxxgSc6&transaction%5B1%5D.pending_reason=NONE&transaction%5B0%5D.status_for_sender_txn=Completed&transaction%5B1%5D.status_for_sender_txn=Completed&transaction%5B0%5D.is_primary_receiver=true&transaction%5B1%5D.receiver=a.smit_1298362298_per%40mac.com&transaction%5B1%5D.amount=USD+5.00&ipn_notification_url=http%3A%2F%2F108.166.107.74%2Fyour-ipn-location%2F&transaction%5B0%5D.amount=USD+10.00&transaction_type=Adaptive+Payment+PAY&cancel_url=http%3A%2F%2F108.166.107.74%2F&reverse_all_parallel_payments_on_error=false&sender_email=a.smit_1329128659_per%40mac.com&transaction%5B1%5D.is_primary_receiver=false&fees_payer=EACHRECEIVER&return_url=http%3A%2F%2F108.166.107.74%2F
我在回复中看不到customerType
orcustomerId
有任何想法吗?