Part 5/5 — Adding, Managing, and Keeping track of subscription payments using Stripe and Mongo for your SaaS app

Part 5 covers deploying your Stripe Application to Production using Heroku

Image for post
Image for post

Store secrets securely

STRIPE_SECRET_KEY=sk_xxx
PRODUCT_BASIC=price_xxx
PRODUCT_PRO=price_xxx
MONGODB=mongodb://localhost:27017/users
STRIPE_WEBHOOK_SECRET=whsec_xxx
TRIAL_DAYS=14
npm install dotenv
require('dotenv').config()
const Stripe = stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: '2020-08-27'
})

Deploy on Heroku

Image for post
Image for post
Image for post
Image for post

Set up a cloud Mongo instance on MongoDB Atlas

Image for post
Image for post
Image for post
Image for post
mongodb+srv://<username>:<password>@saasbase-guides.bibzo.mongodb.net/users?retryWrites=true&w=majority

Configure Webhook for Production

Image for post
Image for post

Final Thoughts

Builds SaaS products — http://saasbase.dev/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store