onCreate response is 200:
{id: "8GN37432852384745",鈥
id: "8GN37432852384745"
links: [{href: "https://api.sandbox.paypal.com/v2/checkout/orders/8GN37432852384745", rel: "self",鈥,鈥
status: "CREATED"
but Paypal tab closes and browser console shows:
Uncaught Error: Expected an order id to be passed
Version: 5.0.124
My code:
<script src="https://www.paypal.com/sdk/js?client-id=MY_ID¤cy=USD&intent=capture"></script>
.Buttons({
createOrder: (data, actions) => this.handlePaypalOrderCreation(data, actions, 100),
onApprove: (data, actions) => this.handlePaypalApprovedTransaction(data, actions),
})
.render('#paypal-button-container')
md5-4a53a3d7ebf2c4d5fd10c17aec94a0da
handlePaypalOrderCreation: function(data, actions, amount) {
try {
actions.order.create({
purchase_units: [
{
amount: {
currency_code: 'USD',
value: amount,
},
},
],
})
} catch (error) {
console.log(error) // Does not log anything
}
},
This error is thrown in this file: https://github.com/paypal/paypal-smart-payment-buttons/blob/265da2f9526fd20734bef29a681cda4b26e5a0ea/src/props/createOrder.js
You need to return actions.order.create({
Thank you.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
You need to
return actions.order.create({