Master Stripe subscriptions with NodeJS in our comprehensive course. Learn to set up, implement, and manage subscription services seamlessly. Perfect for developers looking to integrate Stripe efficiently.
This is a basic NodeJS (express framework) project to show the core concepts of charging for subscriptions via Stripe with Node.
The basic steps to prepare your local system:
-
Clone or Download this repo
-
Move into the folder on your local system and run
npm install
-
Download and install a local version of MongoDB Community Server (if you need help, see our Udemy crash course on MongoDB)
-
Download and install the stripe CLI ( see https://stripe.com/docs/stripe-cli )
The basic steps to run this demo on your local system:
-
Create your stripe account (and subscription product following the instructions in our Udemy crash course on Stripe Subscriptions)
-
Start your local mongo database:
./mongod --dbpath=data
- Create an .env file in your project root directory with the following params (make sure to replace the YOUR_STRIPE with your own specific values)
COOKIE_SECRET=stripe-demo-secret
SERVICE_URL='http://localhost:3000'
HOST=127.0.0.1 DB_PORT=27017 DATABASE=stripe-demo
STRIPE_KEY=YOUR_STRIPE_KEY STRIPE_SECRET=YOUR_STRIPE_KEY PRICE_ID=YOUR_STRIPE_PRICE_ID
- Start your local node server:
npm start
- Start listening for events via the CLI
stripe listen --forward-to localhost:3000/stripe/activate
- Visit your localhost within your web browser at http://localhost:3000 and test the app