Api rest change total
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi i create a button with a dinamic total amount but the problem is when i want change the total if the total on mi car change, do you know how can i change this?
paypal.Button.render({
env: 'production', // sandbox | production
// PayPal Client IDs - replace with your own
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
client: {
sandbox: '*********************-*******',
production: '*********************-*******'
},
// Show the buyer a 'Pay Now' button in the checkout flow
commit: true,
// payment() is called when the button is clicked
payment: function(data, actions) {
// Make a call to the REST api to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: data, currency: 'USD' }
}
]
}
});
},
// onAuthorize() is called when the buyer approves the payment
onAuthorize: function(data, actions) {
// Make a call to the REST api to execute the payment
return actions.payment.execute().then(function() {
window.alert('Payment Complete!');
});
}
}, '#buy_paypal');

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Selected Shipping Method amount not updating to cart for card payment in SDKs
- Prevent changing shipping address via SET_PROVIDED_ADDRESS not working. Orders V2 Advanced Checkout in REST APIs
- No subscription details shown to buyer in their PayPal account in REST APIs
- Using the api to make payments works in Sandbox but not in Live in REST APIs
- How do I update shipping in the popup when using onShippingAddressChange() in REST APIs