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

PayPal Employee
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
- Creating a subscription via the JS SDK, and sending customer-specific information to PayPal in SDKs
- Uncaught ReferenceError: paypal is not defined in PayPal Payments Standard
- Recurring payments with frequency as few minutes in Sandbox Environment
- SDK Integration Sandbox to production mode's sucks so much in Sandbox Environment
- Sanbox Webhooks issue in Sandbox Environment