Feasibility study — Stripe subscription with checkout

Feasibility study — Stripe subscription with checkout

Sample: https://508st.sse.codesandbox.io/

Let us try to achieve a specific billing module using the below documentation as reference:


Stripe has two modes — Test Data and Live Data. This post will contain instructions for both modes in general, unless specified exclusively.


  1. Create a Stripe account — https://dashboard.stripe.com/register and complete the e-mail ID verification.
E-mail verification for Stripe account creation

2. Create a Product with required values — https://dashboard.stripe.com/test/subscriptions/products and then a Pricing Plan on it’s consecutive page with Recurring quantity, desired Price per unit value and other default values.

Product and Pricing Plan creation

3. Complete Account settings by verifying the phone number — https://dashboard.stripe.com/account

Account settings — Phone verification

4. [Required only for Live Data mode]

Activate the account — https://dashboard.stripe.com/account/details/v2

5. Note down the below details from Stripe Dashboard


  1. Create a Checkout Session on Stripe [Client & Server]

Scenario: From the UI, when the customer clicks the Purchase button, an API call will be made to the back-end server, and a Checkout Session must be created on Stripe through an API call from the back-end server.

Ref: https://stripe.com/docs/payments/checkout/subscriptions/starting#create-checkout-session

2. Process the checkout [Client only]

Scenario: Once the UI receives the Checkout Session ID as response, then it can handover the control to the Stripe page where it will take the necessary inputs from the customer to process the checkout.

Ref: https://stripe.com/docs/payments/checkout/subscriptions/starting#redirect-checkout

To ease this step, I have created a simple page to enter the Checkout_Session_ID and the Publishable_key so that we can test both Test data and Live data mode.https://prakash-ces.github.io/stripe_poc

3. Update Subscription to enable Usage threshold [Server only, may be with use of Stripe’s webhooks]

Ref: https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds

Advanced options under Update Subscription page

4. Verify payment and invoice [Live Data mode only]

After a Subscription is created, we should check if the payment passed through and if the customer received an invoice via the registered e-mail.

5. Report Usage [Server only, Live Data mode only]

Send an usage report to Stripe with units exceeding the Subscription plan’s permitted unit and check if the subscription gets renewed immediately by processing the payment and by sending an invoice to the customer.

Ref: https://stripe.com/docs/billing/subscriptions/metered-billing#reporting-usage

By completing all the above steps in Live Data mode, we can confirm the feasibility of the model.

learner. seeker.