#george
1 messages · Page 1 of 1 (latest)
Hi there!
I'm not sure I follow the question. Where else would you like to call complete('fail')?
What about the inner check of error within
if (paymentIntent.status === "requires_action") {
const {error} = await stripe.confirmCardPayment(clientSecret);
if (error) {
// call ev.complete('fail') ??
} else {
// success
}
} else {
// success
}
}
This snippet handles 2 possible errors. The first one is for errors like a pm_card_visa_chargeDeclined and within requires_action there is a second error handler
- Why we don't call
ev.complete('fail')there too? - Could you explain what does
ev.complete('fail')do? I assume it closes the Wallet payment area with a failure reason (i.e. google/apple pay popup)
- Before the line
if (paymentIntent.status === "requires_action")there is aev.complete('success');. So it doesn't make sense to callev.complete('fail')later.
- I think the behavior is a little different between Google and Apple Pay. But in both cases it tells the browser that there was an issue with the payment and display an error message to the user
Thanks for the explanation, not a expert here but why ev.complete('success') isn't called at the very end?
Also some observations from manual tests.
We have 1 confirmCardPayment call at the beggining and depending on the result we can have another, if requires_actions is true
I saw that if ev.complete function is not called before making the second confirmCardPayment call the Google/Apple pay area remains open and a modal may appear for authorization behinds that, blocking the user from interacting with it (Tested with pm_card_authenticationRequiredOnSetup)
Let me know if that's the reason
We have 1 confirmCardPayment call at the beggining and depending on the result we can have another, if requires_actions is true
Yes because a few things can happen:
- When calling
confirmCardPayment, the payment may succeed directly or completely fail or require confirmation (3DS) - If if the latter, then you'll need to call
confirmCardPaymentagain to go though the 3DS flow
Is that the reason ev.complete is being called before requires_action?
Correct. The first part is handled by Google/Apple Pay (which require ev.complete('xxxx')). But the second part is handled by Stripe.