Hi,
I am new to paypal. I have started to use paypal checkout for my application.
From the paypal doc, below is the create order function to the server side.
createOrder: function() {
return fetch('/my-server/create-paypal-transaction', {
method: 'post',
headers: {
'content-type': 'application/json'
}
}).then(function(res) {
return res.json();
}).then(function(data) {
return data.orderID;
});
}
How can I handle error if for any reason I couldn't get the order id? I have the code
onError: function (err) { // Show an error page here, when an error occurs console.log(err); }
If there is any error and if I didn't get order id , now it just show in console that "Expected a promise for a string order id to be passed to createOrder".
How can I show the exact error message?
... View more