#Maycon Sousa
1 messages · Page 1 of 1 (latest)
Hello! Quick question - are you separately creating a SetupIntent in addition to creating the Subscription?
Yes
This is current flow
- create setupIntent
- confirmSetup
- create a customer
- attach the payment method (returned by setupIntent) to customer
- set the payment method as default to customer
- create subscription for customer
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
What's the recommended flow?
- create a customer
- create a subscription for customer
- retrieve the setupIntent from subscription ??
...
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)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'll try this flow..
Do you know if pending_setup_intent will be null for cards like 4242 ?
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