In case anyone else needs this I found the solution. paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [
{
reference_id: "ref",
custom_id: "123456",
amount: {
currency_code: "EUR",
value: "2.40",
breakdown: {
item_total: {
currency_code: 'EUR',
value: '2.00'
},
tax_total: {
currency_code: 'EUR',
value: '0.40'
},
}
},
items: [
{
name: "Item 1",
description: "Description of item 1",
sku: "id1",
unit_amount: {
currency_code: "EUR",
value: "1.00"
},
tax: {
currency_code: "EUR",
value: "0.20"
},
quantity: "1"
},
{
name: "Item 2",
description: "Description of item 2",
sku: "id2",
unit_amount: {
currency_code: "EUR",
value: "1.00"
},
tax: {
currency_code: "EUR",
value: "0.20"
},
quantity: "1"
}
],
}
],
});
},
onApprove: function(data, actions) {
// Capture the funds from the transaction
return actions.order.capture().then(function(details) {
// Show a success message to your buyer
alert('Transaction completed by ' + details.payer.name.given_name);
});
},
onError: function (err) {
alert(err);
}
}).render('#paypal-button-container');
... View more