#cheqo.

1 messages · Page 1 of 1 (latest)

south irisBOT
inner turret
#

Hi there, just to clarify, so you question is how to handle a PaymentIntent when its status is requires_action ?

echo linden
inner turret
#

requires_action doesn't mean a payment failure, it simply indicates that the payment requires action from the customer (i.e., 3DS autuentication).

echo linden
#

Does the <PaymentElement/> component handle custom 3ds rendering itself, such as "confirm 6 digit code sent to your number or something like that?

    <form className="p-4" onSubmit={handleSubmit}>
      <PaymentElement />
      <button
        className="btn btn-primary w-full rounded-full mt-4"
        disabled={!stripe}
      >
        Submit
      </button>
      {/* Show error message to your customers */}
      {errorMessage && <div>{errorMessage}</div>}
    </form>

and then onSubmit i call this strip method:

    const { error } = await stripe.confirmPayment({
      clientSecret: "client_secret",
      confirmParams: {
        return_url: "http://localhost:3000/settings",
      },
      elements,
    });

or should I call, stripe.confirmCardPayment as you mentioned?

inner turret
#

stripe.confirmPayment() will also start the 3DS authentication if needed.

echo linden
inner turret
#

You can also use stripe.confirmPayment() with client_secret to start the 3DS authenticaiton.

The difference is the params that you passed to stripe.confirmPayment().

if you confirm the PaymentIntent from frontend, you pass in an elements to stripe.confirmPayment(), Stripe will create a payment method from the element and use it to confirm the PaymentIntent, it will also start 3DS when necessary.

If you confirm the PaymentIntent from backend and the PaymentIntent's status is requires_action, you can pass a client_secret to stripe.confirmPayment() to start the 3DS flow.

echo linden
inner turret
#

Yes, you can do that as well.

echo linden
#

Thats great. And one more thing, if the error is due insufficient funds would <PaymentElement/> handle custom error message or is it a separate flow that I have to handle in my ui myself?

inner turret
#

No, PaymentElement won't display an error message in this case and your application needs to handle it