data-order-id parameter for checkout JS SDK is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm creating the order on the server side with the PHP SDK then I add the order ID created in the JS script as required :
<script src="https://www.paypal.com/sdk/js?client-id=MY-CLIENT-ID¤cy=EUR&disable-funding=card" data-order-id="MY-ORDER-ID"></script>
But it seems that the JS is not taking it into account, as when i click on the payment button the amount is not set correctly (it's 0.01 EUR instead of 40.00 EUR as I've set on the server side at the creation of the order)
- Labels:
-
Mobile SDKs
-
REST SDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you are searching for:
createOrder: function(data, actions) {
return new Promise(function(resolve, reject) {
resolve("MY-ORDER-ID");
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I'm not sure what to do with the code snippet provided. I'm simply following the example in the documentation....how would what you've posted as a solution fit into this:
<script>
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
currency_code: "CAD",[Removed. Phone #s not permitted]p; }
}],
application_context: {
shipping_preference: 'NO_SHIPPING'
},
payment_method: {
payee_preferred: "IMMEDIATE_PAYMENT_REQUIRED"
}
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
console.log(JSON.stringify(details));
});
}
}).render('#paypal-button-container');
</script>
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Getting errors when integrating standard checkout with my web site. Probably a beginner problem. in SDKs
- Need help to integrate Advanced Checkout (PPCP) With WHMCS in PayPal Upgrade Community
- Need help to integrate PayPal Checkout with Ecwid in PayPal Upgrade Community
- Change the button from Sandbox to Production in REST APIs
- Mandatory Account Creation Hindering Customer Experience in REST APIs