#uh oh

1 messages · Page 1 of 1 (latest)

wintry acornBOT
woeful night
scarlet goblet
#

Aren't we supposed to collect the Payment Method information on the frontend first?

#

The reason is because I have some logic that happens on the backend that calculates what the amount of the payment intent should be

woeful night
#

That's not the recommended flow. See above link

#

What does the amount depend on?

#

You might could still use the recommended flow depending on how you calculate it

scarlet goblet
#

The amount depends on some other logic in my backend

#

It's not something I can use "line_items" for

#

It depends on every transaction

#

Which is why I create the payment intent on the backend and confirm it

#

This was what I was following

#

and this

#

So my flow would be:

  1. User enters their card information on the frontend
  2. The payment method ID is sent to the backend
  3. The backend creates a payment intent with the payment method ID and immediately confirms it
  4. The payment intent succeeds

However, if the payment intent falls in "requires_action" state, I'm not sure what to do. I was thinking of using errors_on_requires_action when creating the payment intent. But I'm wondering if there is a better way

latent jasper
#

Hello 👋
Taking over as codename_duchess needs to step away
Give me a moment to catch up here

#
  1. The payment method ID is sent to the backend
    How exactly are you sending the PaymentMethod ID to your backend? If its a POST request then you can wait for the PaymentIntent confirmation request to respond. if the status is requires_action then you can use handleCardAction function on client-side to allow your customer to perform 3DS auth
#

@scarlet goblet does that help?