#george

1 messages · Page 1 of 1 (latest)

tribal fableBOT
still sequoia
#

Hi there!

#

I'm not sure I follow the question. Where else would you like to call complete('fail')?

pale abyss
#

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

  1. Why we don't call ev.complete('fail') there too?
  2. 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)
still sequoia
#
  1. Before the line if (paymentIntent.status === "requires_action") there is a ev.complete('success');. So it doesn't make sense to call ev.complete('fail') later.
#
  1. 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
pale abyss
#

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

still sequoia
#

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 confirmCardPayment again to go though the 3DS flow
pale abyss
#

Is that the reason ev.complete is being called before requires_action?

still sequoia
#

Correct. The first part is handled by Google/Apple Pay (which require ev.complete('xxxx')). But the second part is handled by Stripe.