I am trying to run a piece of code in the .then section of stripe.redirectTocheckout function. But it redirects me to the successfulUrl part before showing any response/result in the .then({}) and hence the code in the .then section does not run. Kindly help me. I am stuck here from a long time. Thank you.
stripe.redirectToCheckout({
items: [{ sku: 'abcssdd', quantity: 1 }],
successUrl:'https://your-website.com/congratulation',
cancelUrl: 'https://your-website.com/canceled',
})
.then(function (result) {
if (result.error) {
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
console.log("Inside Then");
})