HOW to pass the items array while creating an order in javascript while using php
samebenezer
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Apr-18-2020
04:05 AM
I have a shopping cart that can contain variable number of products based on the customer's preference.
I would line to know how to create and pass an array containing all the items in php to the javascript code before order creation.
Any help regarding this would be really helpful.
createOrder: function(data, actions) {
return actions.order.create({
intent:"CAPTURE",
application_context:{
shipping_preference: 'SET_PROVIDED_ADDRESS',
return_url :"",
},
purchase_units: [{
amount: {
currency_code: "USD",
value: "<?php echo $total ?>"
},
items: { //THIS IS WHERE I WANT TO INCLUDE EACH ITEM USING PHP
}
}]
});
}
1 REPLY 1
MTS_Chiranjeevi
Moderator
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May-15-2020
06:16 AM
Hi @samebenezer,
Thank you for contacting PayPal community.
We apologize for any inconvenience.
I request to please use the "items" array under "purchase_unit_request ".
Thank you for understanding and patience.
Sincerely,
Chiranjeevi
PayPal, Inc.
If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.
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
- Disputes Webhook does not works on Sandbox (23/04/24) in Sandbox Environment
- can we assign a unique detail to every subscription creation? in NVP/SOAP APIs
- Button in PayPal Payments Standard
- Change the button from Sandbox to Production in REST APIs
- Issue with Rendering Trustly Payment Button via PayPal JavaScript SDK in SDKs