How To Setup Recurring Payments With Stripe Checkout
Just a couple weeks ago I wrote a step-by-step guide showing you how to setup Stripe Checkout using Express.js and Heroku. This guide only showed you how to setup one-time payments, but what if you want to setup recurring payments so you can sell subscriptions?
You’re in luck, I’ll show you how to set this up today in this post!
First, if you haven’t yet, go ahead and go through this guide and setup Stripe Checkout with one-time payments. If you already have that setup, it’s only a small change to setup recurring payments instead of the one-time payment.
After that’s setup, we need to create a product and pricing plan inside our Stripe Dashboard!
After creating your product and plan, you’ll want to snag the ID for your plan. It’ll look like this ‘plan_DguBnFdeQ27pja’:
Currently, after following this guide, you’ll have this bit of code here on lines 22-37 in the app.js file.
This code obviously makes only a one-time payment, so we need to change it to the following:
You’d replace ‘plan_yourstripeplanID’ with your Stripe plan ID you got from earlier.
That’s it! Go ahead and test out your Stripe Checkout form to make sure it’s now making recurring payments by using a test card.
If it’s all working correctly, go ahead toggle out of ‘Test View’ mode inside your Stripe Dashboard to go into live mode. Then you’re going to have to setup your Product and Plan again add your live mode plan ID to your code like shown above.
It’s kind of confusing how you have to jump between test mode and live mode but that’s just how Stripe works. You are in test mode when you’re developing your checkout form and testing it, then you have to switch to live mode when you’re ready to real payments from customers. You can read more about it here.
What are you waiting for!? Go setup recurring payments and start selling some subscriptions! :)Tweet