Pass an array of items to purchase_units

cxxxv1
Contributor
Contributor

Trying to pass an array of items in array 'tixtopurch'. Array is created as follows:


tixtopurch.push([{"name":PLAYNAME,
"description":SCHEDDATE + ' SEAT: ' + seatInfo.settings.label,
"unit_amount":{"currency_code":"USD","value":seatInfo.data().price},
"quantity":"1"}]);

 

purchase_units: [{
amount: {
currency_code: "USD",
value: ppFEE.toFixed(2),
breakdown: {
item_total: {
currency_code: "USD",
value: ppFEE.toFixed(2)
}
}
},
items: tixtopurch

 

Paypal returns a malformed request error. If I enter the items directly in the items then it works. Have not been able to find why it does not like the array.

Login to Me Too
1 REPLY 1

MTS_Chiranjeevi
Moderator
Moderator

Good day @cxxxv1,

 

Thank you for posting to the PayPal community.

 

Yes, while performing the "Create Order" API call, merchant(i.e you) should pass the "items" value under "purchase_unitsthat the customer purchased which contains the name, quantity, description etc.

 

https://developer.paypal.com/docs/api/orders/v2/#orders_create

https://developer.paypal.com/docs/api/orders/v2/#orders_create!path=purchase_units/items&t=request 

 

If your still facing any issues, please create a MTS ticket via - https://www.paypal-support.com/s/?language=en_US  with the detail information and error details.

 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.