This repository shows you how to use Node (version 8+) and Stripe to create recurring subscriptions with built-in SCA support. It is an updated version of stripe-recurring-subscriptions.
It uses Express for creating a simple server, Nunjucks for templating, and the Stripe API.
We’ve written 2 detailed tutorials about this code on the 🌟 CodeNebula blog:
🌟How to Set up a Basic Node Application with Stripe
🌟How to use Stripe’s new Payment Intents API with Node.js to create subscriptions with built-in SCA
- Clone this repository
- Run
npm install
to install all dependencies - Create a
.env
file to house your Stripe Secret Key (this repo includes.env
in its.gitignore
) - In the
.env
file, set your secret key as STRIPE_API_KEY (STRIPE_API_KEY="sk_test_************************"
) - In the Javascript section of the
views/register.html
file, replacevar stripe = Stripe("pk_test_************************")
with your Stripe Publishable Key - Run the app via
npm run start
- Navigate to localhost:3000