write accessories to a product in the paypal.Buttons function in js in the "item_list":{ "items":...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, everyone,
As described, I would like to sell accessories that belong to a main article together with the main article. I add up the prices of the various accessories in js and send them to Paypal. That works too.
Under "item_list":{ "items":...I would then like to transfer the accessories to PayPal. Unfortunately I do not get back the information sent to PayPal. So I don't know how to access it or where to view it. Unfortunately, I can't find it in the Bussness portal. I can't find it under "orderData, JSON.stringify(orderData, null, 2)" either.
Ín short: I would like to get the information in red back from Paypal to see what was ordered.
// Sets up the transaction when a payment button is clicked
createOrder: (data, actions) => {
return actions.order.create({
"style": {
"layout": "vertical",
"color": "white",
"shape": "rect",
"label": "buynow",
},
"purchase_units": [{
"amount": {
"currency_code": "EUR",
"value": euroweg(document.getElementById('summe_mittel_id').innerHTML),
"breakdown": {
"item_total": { /* Required when including the `items` array */
"currency_code": "EUR",
"value": euroweg(document.getElementById('summe_mittel_id').innerHTML)
}
}
},
"item_list":{
"items": [
{
"name": "Der Stamm - Mittel", /* Shows within upper-right dropdown during payment approval */
"description": "Optional descriptive text..", /* Item details will also be in the completed paypal.com transaction view */
"unit_amount": {
"currency_code": "EUR",
"value": "100",
},
"quantity": "100"
},
{
"name": "Das Deko Packet", /* Shows within upper-right dropdown during payment approval */
"description": "Optional descriptive text..", /* Item details will also be in the completed paypal.com transaction view */
"unit_amount": {
"currency_code": "EUR",
"value": "100",
},
"quantity": "100"
},
],
}
}]
});
},
// Finalize the transaction after payer approval
onApprove: (data, actions) => {
return actions.order.capture().then(function(orderData) {
// Successful capture! For dev/demo purposes:
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
const transaction = orderData.purchase_units[0].payments.captures[0];
window.location.href='success.html';
alert(`Transaction ${transaction.status}: ${transaction.id}\n\nSee console for all available details`);
// When ready to go live, remove the alert and show a success message within this page. For example:
// const element = document.getElementById('paypal-button-container');
// element.innerHTML = '<h3>Thank you for your payment!</h3>';
// Or go to another URL: actions.redirect('thank_you.html');
});
},
oncancel:function(data){
window.location.href="oncancel.html";
}
}).render('#paypal-button-container');
Thank you for the help, I'm desperate.
Regards
Vinzent
- Labels:
-
Payouts Rest APIs

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Help me find the solution for the error 'rwindow.paypal.Buttons is undefined.' in Next.js project in PayPal Payments Standard
- React-JS Paypal Button Isn't Working in Production for iOS 17 Safari in SDKs
- paypal_js_sdk_v5_unhandled_exception {err: 'Error: No ack for postMessage init() in SDKs
- PayPal api trying to find the fee amount deducted from the payment in REST APIs
- Integrate Standard Integration into a NextJS 13 application using the App Router in SDKs