#zzking

1 messages · Page 1 of 1 (latest)

blazing roostBOT
hallow wren
#

Hi there!

#

Seems like an odd flow. Why not directly create the SetupIntent or PaymentIntent to automatically create the PaymentMethod for you?

lone remnant
#

I know.. the code is a bit old so it's not feasible to completely re-write everything

#

But everything seems fine if I follow what I described, and from stripe's API doc, it seems it's OK to attach an existing payment_method when creating a setupIntent or a paymentIntent

hallow wren
#

Yes once you have an existing PaymentMethod, you can use it with a PaymentIntent.

lone remnant
#

and a setupIntent ,right ?

hallow wren
#

Correct. But if you already have a PaymentMethod saved on a customer, then there's no point in doing a SetupIntent.

lone remnant
#

We want to "save the card for future usage", especially in the EU where SCA is required, so I think a setupIntent IS required for this use case ,right ?

#

bascially we'd need customer to authenticate the card first , should SCA happens

hallow wren
#

In your original question you said "create a customer and attach the payment_method to the customer". So if you already attached the PaymentMethod, no need for a SetupIntent. But you could use the SetupIntent to attach the PaymentMethod in the first place.

lone remnant
#

In your original question you said "create a customer and attach the payment_method to the customer". So if you already attached the PaymentMethod,
Then how would you trigger a card authentication in this case ?

#

I mean without a setupIntent, how could you tell the bank (via Stripe) to authenticate the card ? I believe it would not happen if I just attach the payment_method to the customer , right ?

lone remnant
#

@hallow wren sorry, any thoughts ?

hallow wren
#

Oh sorry for the delay (Discord has been busy). Looking into this now.

lone remnant
#

no problem, thank you. I know our flow might be a bit odd (due to the code being old), but I THINK it would still work, especially in the context of SCA

hallow wren
#

Yes you are correct. If you want to trigger 3DS, then yes you need to use a SetupIntent. So I would recommend something this:

  1. Create the PaymentMethod
  2. Add it to a SetupIntent. This will automatically: attach it to the customer and trigger 3DS if needed
lone remnant
#

Almost like what we are doing:

  1. Create the PaymentMethod
  2. Create the Customer, and attach the PaymentMethod to the Customer
  3. Create the SetupIntent, and attach Customer/PaymentMethod to the SetupIntent during the creating procedure. This should trigger 3DS if needed.

I believe above should also work ? Sorry just trying to fit my code into our current codebase with less branching

hallow wren
#

"attach the PaymentMethod to the Customer" in step 2 seems useless (since the SetupIntent will take care of this), but technically it should work.

lone remnant
#

hmmm, interesting. Thanks for that ! Another related question is:

AFAIK , setupIntent or paymentIntent with "setup_for_future_usage:off_session" are both optimised for the SCA flow when saving a card. I'd like to know if we apply the same logic to the US where SCA is not required , would it also always trigger a 3DS card authentication during the card setup procedure ?

hallow wren
#

would it also always trigger a 3DS card authentication
No, it would only trigger 3DS if the bank requests it.

lone remnant
#

aha great, that's nice to know. Thanks for your help

hallow wren
#

Happy to help 🙂

blazing roostBOT