#kellycarpet - Setup Intents
1 messages · Page 1 of 1 (latest)
Hello! We do recommend using a Setup Intent for this flow, yes. When creating the Subscription a Setup Intent will be created for you to use. You can find it in the Subscription's pending_setup_intent property: https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent
You would use the Setup Intent instead of attaching the Payment Method directly to the Customer (the Setup Intent will attach the Payment Method to the Customer for you once successfully confirmed).
thanks! what does the flow look like on the client side?
do i create the subscription first, and then use that setup intent to collect the credit card details?
Our recommended flow is to send that Setup Intent's client_secret to your client-side code and use stripe.confirmCardSetup so your Customer can be prompted for any required authentication at that time: https://stripe.com/docs/js/setup_intents/confirm_card_setup
Server - create customer, create subscription, send the setup intent's client secret to client side
client side - collect cc, expiry, cvc, send to confirmCardSetup along with the client secret, send payment method to server side
Server - save payment method onto subscription or customer?
No need for that last step, running confirmCardSetup will save the Payment Method to the Customer for you.
ah, gotcha. so after that my subscription with the trial period is all setup for the customer?
It should be, yep. You should try this out in test mode to see how it works in practice and make sure everything works as expected. You can create test Subscriptions with a trial that ends in a few minutes to see how the first payment works.
sounds good, thank you!