in PayPal Rest API, when create payment, one payment can take multiple transactions?
Lar_ang
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
May-15-2018
09:13 AM
I am working with PHP PayPal Rest API.
I am making code from this link - http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingPayPal.html
It contains this code.
$transaction = new Transaction();$transaction->setAmount($amount) ->setItemList($itemList) ->setDescription("Payment description"); ...$payment = new Payment();$payment->setIntent("sale") ->setPayer($payer) ->setRedirectUrls($redirectUrls) ->setTransactions(array($transaction));
And it works well.
It seems one payment can take multiple transactions as array.
But when take multiple transactions like this:
$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));
It doesn't work and it shows error like this.
'Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment.'
Is it impossible to take multiple transactions to one payment?
Or this error is from other reason? what is the reason?
Thanks much for help!
Labels:
- Labels:
-
API
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Shipping options are not appearing in my cart through link or button. in PayPal Payments Standard
- Receiving a PAYMENT.SALE.COMPLETED webhook notification - how can I trace the parent Subscription in REST APIs
- My webhook stopped working 2 weeks ago in REST APIs
- Getting API error PAYEE_ACCOUNT_INVALID, I set the payee to my merchant id. in REST APIs
- Recurring payments for cart with multiple individually subscribable items? in PayPal Payments Standard