#Indikakis2
1 messages · Page 1 of 1 (latest)
Hi there, can you share with me the relevant code?
const {cperror} = await stripe.confirmPayment({
elements,
clientSecret,
confirmParams: {
return_url: window.location.origin + '/post_stripe.php',
},
});
console.log(JSON.stringify(cperror));
if(cperror){
addMessage(cperror.message);
location.replace(window.location.origin + '/post_stripe.php?payment_intent='+pi_id);
return;
//showMessage(cperror.message);
}
Thanks. you should use error instead of cperror.
OK, Thank you so much!!!
by the way I also use this const {error, paymentMethod} = await stripe.createPaymentMethod in my program. So we can't have same const error in that. How can I handle it? Can we use var ?
Is your question about using var keyword instead of const?
nope, I also use this code const {error, paymentMethod} = await stripe.createPaymentMethod in my program. Can we have const error twice
OK, you can do something like const {error: ERROR2, paymentMethod} = await stripe.createPaymentMethod
And reference the second error by ERROR2
if (ERROR2) {
// Do something
}```
Thanks, I hope that javascript will not flag an error. Thank you so much!!!