#Indikakis2

1 messages · Page 1 of 1 (latest)

tulip escarpBOT
sleek dirge
#

Hi there, can you share with me the relevant code?

lusty herald
#

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);  
    }
sleek dirge
#

Thanks. you should use error instead of cperror.

lusty herald
#

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 ?

sleek dirge
#

Is your question about using var keyword instead of const?

lusty herald
#

nope, I also use this code const {error, paymentMethod} = await stripe.createPaymentMethod in my program. Can we have const error twice

sleek dirge
#

OK, you can do something like const {error: ERROR2, paymentMethod} = await stripe.createPaymentMethod
And reference the second error by ERROR2

if (ERROR2) {
// Do something
}```
lusty herald
#

Thanks, I hope that javascript will not flag an error. Thank you so much!!!