我正在使用PHP PayPal Rest API。
我正在通过此链接制作代码 - http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingPayPal.html
它包含此代码。
$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("Payment description");
...
$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
效果很好。
似乎一笔付款可以将多笔交易作为数组。
但是当这样做多个交易时:
$transaction1 = new Transaction();
$transaction1->setAmount($amount1)
->setItemList($itemList1)
->setDescription("Payment1 description");
$transaction2 = new Transaction();
$transaction2->setAmount($amount2)
->setItemList($itemList2)
->setDescription("Payment2 description");
...
$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction1, $transaction2));
它不起作用,它显示这样的错误。
'访问https://api.sandbox.paypal.com/v1/payments/payment时获得Http响应代码400。'
是否无法将多笔交易记入一笔付款?
或者这个错误是出于其他原因?是什么原因?
非常感谢任何人的帮助!