// project

Stripe + Flask Recurring Revenue Guide

A beginner-friendly guide to implementing Stripe subscriptions in a Flask web application.

Year 2025
Type Open-source Guide · README
Links GitHub →
Python Flask Stripe Guide Open Source

Overview

This guide explains how the Stripe integration works in a Flask app and gives a beginner-friendly overview of the Stripe concepts used. It documents the current app flow and where Stripe connects into it.

The repository also includes two additional branches for common use cases:

  • Switch to the free_trial branch for a solution with a 7-day trial period.
  • Switch to the discount_codes branch for a solution with discount code support.

Why I Built This

When building GolfOptimise, I implemented the Stripe integration by following YouTube guides. While it worked, it left me without a solid understanding of how Stripe actually works or how to use it correctly in a recurring subscription model for a web application.

I then wrote a thorough README so that other Flask developers can learn the best practices when it comes to Stripe — and so that I can quickly implement a clean Stripe solution in any future project without starting from scratch.

This involved reading through the official Stripe documentation, completing the official Stripe training, and then structuring everything I had learned into a logical, digestible format for my future self and others.

What it covers

  • Core Stripe concepts: Customers, Products, Prices, PaymentIntents and Subscriptions
  • Setting up recurring subscription billing in Flask end-to-end
  • Handling Stripe webhooks correctly and securely
  • Managing subscription lifecycle events (upgrades, cancellations, failures)
  • Implementing a free trial period
  • Adding discount code support