Skip to content
Advertisement

How to create a customer, payment method, subscription all in one step in Stripe

Stripe has so many different methods it’s kinda confusing which one to used. I have a credit card form for the user after he/she has selected the subscription they want to purchase. From this point, I want to create the customer, setup payment and subscription all in one step.

Do I do:

  1. Create customer
  2. Create payment method
  3. Create subscription

OR

  1. Create Intent
  2. Create Session

Or does creating a session handle create customer, create payment method and create subscription all in one?

Advertisement

Answer

If you want to use the hosted Checkout solution, you would not collect payment details yourself. Stripe does that for you as part of the Checkout flow. You can create a customer ahead of time, but by default Checkout will create one for you.

Most likely using Checkout with mode=subscription to start a subscription is going to be your most straightforward option. If you do use Checkout this way, you would not create any Subscriptions/Intents directly yourself. You can also use the Customer Portal to manage changes to the subscriptions later.

You can also go with the custom flow you described, creating the customer, attaching payment methods and starting a subscription, but this is more involved.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement