[英]What's the JSON for PayPal Adaptive Payments Chained Payment
I've successfully implemented creating simple payments in Rails using the paypal-sdk-adaptivepayments
gem. 我已经成功实现了使用
paypal-sdk-adaptivepayments
gem在Rails中创建简单付款的功能。 The JSON is as follows from the documentation: JSON来自文档,如下所示:
{
:actionType => "PAY",
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
:currencyCode => "USD",
:feesPayer => "EACHRECEIVER",
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
:receiverList => {
:receiver => [{
:amount => self.amount,
:email => self.help_request.creator.master_profile.paypal_email }] },
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay"
}
I need, however, to set up a similar JSON string but with multiple receivers (one primary) for a chained payment. 但是,我需要设置一个类似的JSON字符串,但要使用多个接收者(一个主要接收者)来进行链式付款。 The PayPal docs show how to do this, but it's not in JSON which is what I need for the SDK:
PayPal文档显示了如何执行此操作,但是它不是使用JSON的,因此我需要使用SDK:
&actionType=PAY
&cancelUrl=http:\\example.com\cancel.htm
¤cyCode=USD
&receiverList.receiver(0).amount=9.00
&receiverList.receiver(0).email=andrea@example.com
&receiverList.receiver(1).amount=5.00
&receiverList.receiver(1).email=linda@example.com
&requestEnvelope.errorLanguage=en_US
&returnUrl=http:\\example.com\return.htm
Anybody know how to set this up? 有人知道如何设置吗? It's not immediately obvious
这不是立即显而易见的
I found out the format, and it's not intuitive. 我发现了格式,而且不直观。 The basic structure can be seen here where they show it this way:
基本结构可以在此处以这种方式显示:
params = {
'requestEnvelope' : {'errorLanguage' : 'en_US', 'detailLevel' : 'ReturnAll'},
'actionType' : 'PAY',
'receiverList' : {
'receiver' : [
{'email' : receiver1, 'amount' : amount1, 'primary' : True },
{'email' : receiver2, 'amount' : amount2, 'primary' : False},
{'email' : receiver3, 'amount' : amount2, 'primary' : False}
],
},
'currencyCode' : 'USD',
'memo' : 'Chained payment example.',
'cancelUrl' : cancel_url,
'returnUrl' : return_url,
}
Here's roughly what I used in my application: 这大致是我在应用程序中使用的:
{
:actionType => "PAY",
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
:currencyCode => "USD",
:feesPayer => "PRIMARYRECEIVER",
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
:receiverList => {
:receiver => [{
:amount => self.amount,
:email => self.help_request.creator.master_profile.paypal_email,
:primary => 'true' },
{
:amount => self.fee_amount,
:email => 'receiver2@email.com',
:primary => 'false' }
]
},
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.