0👍
I’m Dealing with same issues for Hours in NodeJS and i was able to fix it the issue is on Your Json not in PayPal configurations.
let order;
try
{
order = await client.execute(request);
let response = {
statusCode: '200',
body: JSON.stringify({ orderID: order.result.id }),
headers: {
'Content-Type': 'application/json',
}
};
return JSON.stringify({ orderID: order.result.id });
}
catch (err)
{
console.error(err);
let response = {
statusCode: '500',
body: JSON.stringify({ error: 'Something Went Wrong While Creating Order..!' }),
headers: {
'Content-Type': 'application/json',
}
};
return response;
}
this is how i modify my return on nodejs server side
body: JSON.stringify({ orderID: order.result.id })
and this is my Create Order function
createOrder: function() {
return fetch('http://localhost:3000/PayPal/Pay', {
method: 'post',
headers: {
'content-type': 'application/json'
}
}).then(function(res) {
return res.json();
}).then(function(data) {
console.log("data.orderID" +data);
return data.orderID; // Use the same key name for order ID on the client and server
});
}
}).render('#paypal-button-container')});
Sorry i Don’t know anything about Vue so i can’t help with that. but hope this will help you ..! Good luck
- [Vuejs]-Render a date that comes asynchronous for each item in v-for
- [Vuejs]-Vue multiselect not getting id and name
Source:stackexchange.com