New to the community? Welcome! Please read our Community Rules and Guidelines
If you want to report illegal content under the EU Digital Services Act, please do so here
Hi there,
I have integrated the Smart buttons into a form we have for registrations and wanted to allow the user to register multiple people at the same time.
Is this possible with the Smart Buttons and if so is there any documentation or examples for doing it?
Currently my button code looks like:
var order_value = $('#course-summary').data('price');
paypal.Buttons({
style: {
layout: 'horizontal',
color: 'white',
shape: 'rect',
label: 'paypal',
tagline: false
},
createOrder: function(data, actions) {
return actions.order.create({
"intent": "CAPTURE",
purchase_units: [{
amount: {
"currency_code": "GBP",
value: order_value
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + ' - Order ID = ' + data.orderID);
// Call your server to save the transaction
return fetch('/paypal-transaction-complete', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID
})
});
});
}
}).render('#paypal-button-container');
I have looked at the onclick attribute but not worked out how to use it to update the value. Also noticed for the changing shipping examples there is