我正在开发一个应用程序,其中用户A可以从不同的卖家购买多达10件物品,所以我需要同时向不同的用户汇款,我正在尝试使用Paypal链式付款。
现在我正在玩Classic API(自适应支付),但我只是想知道为什么我总是会收到这个错误:
"The fee payer PRIMARYRECEIVER can only be used if a primary receiver is specified"
我已经指定了一个主接收器,但我仍然遇到了这个错误。
我找到了这些例子:https://paypal-sdk-samples.herokuapp.com/adaptive_payments/pay 我试图做一个链式付款:
这是我的付款申请:
require 'paypal-sdk-adaptivepayments'
@api = PayPal::SDK::AdaptivePayments::API.new
# Build request object
@pay = @api.build_pay({
:actionType => "PAY",
:cancelUrl => "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/pay",
:currencyCode => "USD",
:feesPayer => "PRIMARYRECEIVER",
:ipnNotificationUrl => "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/ipn_notify",
:receiverList => {
:receiver => [{
:amount => 1.0,
:email => "platfo_1255612361_per@gmail.com",
:primary => true }] },
:returnUrl => "https://paypal-sdk-samples.herokuapp.com/adaptive_payments/pay",
:sender => {
:useCredentials => true } })
# Make API call & get response
@pay_response = @api.pay(@pay)
这是回复
{
:responseEnvelope => {
:timestamp => "2013-11-20T05:16:31-08:00",
:ack => "Failure",
:correlationId => "b002d0e27fd33",
:build => "7935900" },
:error => [{
:errorId => 580023,
:domain => "PLATFORM",
:subdomain => "Application",
:severity => "Error",
:category => "Application",
:message => "The fee payer PRIMARYRECEIVER can only be used if a primary receiver is specified",
:parameter => [{
:value => "feesPayer" },{
:value => "PRIMARYRECEIVER" }] }] }
提前致谢!
答案 0 :(得分:3)
看一下你的电话,你确实指定了一个主接收器。但是,对于链式支付,您必须指定辅助接收方。
我刚刚使用以下参数进行了快速测试:
actionType = PAY
requestEnvelope.errorLanguage = en_US
cancelUrl = http://abortURL
returnUrl = http://returnURL
ipnNotificationUrl = http://ipnURL
applicationId = Test
memo = Test
currencyCode = USD
receiverList.receiver(0).email = test@test.com
receiverList.receiver(0).amount = 5.00
receiverList.receiver(0).primary = true
feesPayer = PRIMARYRECEIVER
得到了结果:
responseEnvelope.timestamp=2013-11-20T05:41:56.751-08:00
responseEnvelope.ack=Failure
responseEnvelope.correlationId=b61a6b31ea2ab
responseEnvelope.build=7935900
error(0).errorId=580023
error(0).domain=PLATFORM
error(0).subdomain=Application
error(0).severity=Error
error(0).category=Application
error(0).message=The fee payer PRIMARYRECEIVER can only be used if a primary receiver is specified
error(0).parameter(0)=feesPayer
error(0).parameter(1)=PRIMARYRECEIVER
但是,一旦我将FeesPayer更改为EACHRECEIVER,我就会收到导致链式付款失败的错误消息:
responseEnvelope.timestamp=2013-11-20T05:48:09.202-08:00
responseEnvelope.ack=Failure
responseEnvelope.correlationId=987210ec4d03a
responseEnvelope.build=7935900
error(0).errorId=579008
error(0).domain=PLATFORM
error(0).subdomain=Application
error(0).severity=Error
error(0).category=Application
error(0).message=You must specify only one primary receiver and at least one secondary receiver
error(0).parameter(0)=1
我希望这会有所帮助。
有关其他示例和灵感,请参阅http://paypal.github.io/#adaptive-payments下提供的PayPal自适应付款SDK