#Indikakis2
1 messages · Page 1 of 1 (latest)
Could you share your code of confirmCardPayment?
const cnfResult = await stripe.confirmCardPayment(clientSecret, {
payment_method: pmId,
return_url:window.location.origin + '/post_stripe.php'
});
if(cnfResult.error){
addMessage(cnfResult.error.message);
return;
}
else{
if(cnfResult.paymentIntent.status === "succeeded"){
// addMessage("Payment Success");
}
else{
addMessage("PaymentIntent status: " + cnfResult.paymentIntent.status);
//console.log("PaymentIntent status: " + cnfResult.paymentIntent.status);
}
}
Thanks for sharing the code. For confirmCardPayment, return_url will only be triggered when there's any next action such as performing 3DS.
If there's no next action, the response will return immediately without redirection to the return_url
redirect_to_url is not a parameter on confirmCardPayment: https://stripe.com/docs/js/payment_intents/confirm_card_payment
So to perform a similar return_url action in stripe.confirmPayment for the confirmCardPayment, I would have to manually add a redirect code? e.g. if(cnfResult.paymentIntent.status === "succeeded"){
location.replace (.....)
}
Yes, you're right! confirmPayment has ability to control the redirect behaviour whereas confirmCardPayment can't. In order to achieve the same redirection behavior in confirmCardPayment, it can only be done manually
Thank You so much.