PayPal Adaptive Payments API无法使用多个接收器

时间:2012-03-19 01:29:52

标签: python paypal paypal-adaptive-payments

我正在为Paypal的自适应支付API开发一个Python绑定,目前我正在实施并行/链接支付呼叫,但我陷入了一个相当神秘的错误。

我已经实现了Pay API Operation中详述的基本“PAY”操作,其参数如下:

{'actionType': 'PAY',
'cancelUrl': 'http://my_domain.com/cancel_url',
'clientDetails.applicationId': 'My Application ID',
'clientDetails.ipAddress': 'MY IP',
'currencyCode': 'USD',
'receiverList.receiver(0).amount': 15,
'receiverList.receiver(0).email': 'sandbox_test_account@email.com',
'requestEnvelope.detailLevel': 'ReturnAll',
'requestEnvelope.errorLanguage': 'en_US',
'returnUrl': 'http://my_domain.com/cancel_url'}

它工作得非常好,但是当我尝试在receiverList对象中添加更多接收器时,Paypal会给我一个没有任何说明的错误:

{'error(0).category': ['Application'],
'error(0).domain': ['PLATFORM'],
'error(0).errorId': ['580001'],
'error(0).message': ['Invalid request: {0}'],
'error(0).severity': ['Error'],
'error(0).subdomain': ['Application'],
'responseEnvelope.ack': ['Failure'],
'responseEnvelope.build': ['2486531'],
'responseEnvelope.correlationId': ['f454f1118f799'],
'responseEnvelope.timestamp': ['2012-03-18T17:48:10.534-07:00']}

总而言之,它没有说明请求无效的地方,我真的找不到更改第一个参数集添加的错误:

'receiverList.receiver(1).amount': 15,
'receiverList.receiver(1).email': 'sandbox_2nd_test_account@email.com'

我是否必须启用某些内容来测试Sandbox中的链式/并行付款,或者我是否忘记了要发送的基本标头/参数中的某些配置?

感谢您的帮助

1 个答案:

答案 0 :(得分:2)

在联系PayPal后,他们告诉我尝试按顺序发送receiverList对象,例如:

{'actionType': 'PAY',
'cancelUrl': 'http://my_domain.com/cancel_url',
'clientDetails.applicationId': 'My Application ID',
'clientDetails.ipAddress': 'MY IP',
'currencyCode': 'USD',
'receiverList.receiver(0).amount': 15,
'receiverList.receiver(0).email': 'sandbox_test_account@email.com',
'receiverList.receiver(1).amount': 15,
'receiverList.receiver(1).email': 'sandbox_test_account@email.com',
'requestEnvelope.detailLevel': 'ReturnAll',
'requestEnvelope.errorLanguage': 'en_US',
'returnUrl': 'http://my_domain.com/cancel_url'}

当我将主体实现为Python字典时,它变得无序,所以我开始使用OrderedDict为我做了诀窍:)

相关问题