Smart buttons - Update value on event or button click
damianohm
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Aug-21-2019
08:22 AM
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
actions.order.patch but I can't find other examples of it's use.
Any help welcome!
Thanks
0 REPLIES 0

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
- How to prompt a "thank you" after using donate button on a website in PayPal Payments Standard
- Website Payment Button in PayPal Payments Standard
- changing prices on paypal buttons in PayPal Payments Standard
- use the payment button code with variable price in REST APIs
- Paypal buttons and redirects in PayPal Payments Standard