PayPal Adaptive Payments Chained Payment 的 JSON 是什么

What's the JSON for PayPal Adaptive Payments Chained Payment

我已经使用 paypal-sdk-adaptivepayments gem 在 Rails 中成功实现了创建简单支付。 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"
  }

但是,我需要设置一个类似的 JSON 字符串,但具有多个接收方(一个主要接收方)以进行链式支付。 PayPal 文档展示了如何执行此操作,但它不在 JSON 中,而这正是我需要的 SDK:

&actionType=PAY
&cancelUrl=http:\example.com\cancel.htm
&currencyCode=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

有人知道如何设置吗?不是很明显

我发现了格式,它不直观。可以看到基本结构 here 他们以这种方式显示的地方:

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,
}

我在申请中大致使用了以下内容:

  {
    :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"
  }