#Maycon Sousa

1 messages · Page 1 of 1 (latest)

vocal dirgeBOT
minor venture
#

Hello! Quick question - are you separately creating a SetupIntent in addition to creating the Subscription?

wraith umbra
#

Yes

#

This is current flow

  1. create setupIntent
  2. confirmSetup
  3. create a customer
  4. attach the payment method (returned by setupIntent) to customer
  5. set the payment method as default to customer
  6. create subscription for customer
minor venture
#

So first off, I wouldn't recommend creating a separate SetupIntent at all. If the Subscription is trialing, it'll create a setupIntent for you that you can use to collect the payment details

wraith umbra
#

What's the recommended flow?

#
  1. create a customer
  2. create a subscription for customer
  3. retrieve the setupIntent from subscription ??
    ...
minor venture
#

Yup!

#

You'd get the SetupIntent from pending_setup_intent on the Subscriptoin (https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent) and then go through the normal confirmation flow to collect the payment method (which should be automatically attached when confirmation is successful)

wraith umbra
#

I'll try this flow..

Do you know if pending_setup_intent will be null for cards like 4242 ?

minor venture
#

It doesn't really matter what the card is - if the Subscription is created and doesn't charge any amount when it's first generated (because of a trial) then it'll have a pending_setup_intent