#clioso

1 messages · Page 1 of 1 (latest)

tranquil edgeBOT
pallid scroll
#

Hi there

#

Are you planning on starting the Subscription immediately when you collect the customer's PaymentMethod or you are going to start it later when they are no longer on-session?

radiant fossil
#

I use both actually. instant charge by default but there are also scenarios where there's an old subscription and the new one is just getting attached (which would then mean an off-session charge)

pallid scroll
#

Okay so let's start with the first scenario.

#

Really you don't want to be creating a SetupIntent at all here.

#

What you want to do is create the Subscription with payment_behavior: default_incomplete and then pass the latest_invoice.payment_intent.client_secret to your frontend to use with confrimPayment()

#

This will ensure that you always handle 3DS if it is required on the initial payment and it will properly set up the payment method for the future.

#

Then, for the second scenario, you want to do a similar thing. If you run into the PaymentIntent moving to requires_action then you need to bring your Customer back on-session and pass the client_secret to your frontend to then confirm client-side. In this case since you already have a PaymentMethod you can just use confirmCardPayment() to present the Authentication UI.

radiant fossil
#

Makes sense. Thanks. But I can still use payment methods that have already been set up (for the first scenario) right?

pallid scroll
#

Oh yeah sorry.

#

In that case it would be the same thing as the second scenario

radiant fossil
#

Alright, thanks for your help!