A subscription billing pipeline that survives failure
An uptime monitoring product built around the part most teams get wrong: Stripe subscriptions, webhooks and the states in between. Our own product, built to be shown rather than described.
- FastAPI
- PostgreSQL
- Celery
- Redis
- Stripe
- Next.js
- Docker
/The problem
Billing code fails in ways that are invisible until money is involved. Webhooks arrive twice, arrive out of order, or arrive while the user is already on a different plan. Each of those quietly produces a wrong subscription state that nobody notices for a month.
/The approach
Webhook handlers are idempotent and keyed on the event id, so a duplicate delivery changes nothing. Subscription state is derived from Stripe rather than mirrored optimistically, so a missed event self-corrects on the next sync. Prices are versioned, so changing a plan does not silently reprice existing customers. Background work runs in Celery with Redis, and the whole stack is containerised.
/The outcome
244 automated tests covering the billing paths specifically, including duplicate and out-of-order webhook delivery, plus an admin console for inspecting subscription state. Runs against live Stripe test keys, so the integration is exercised rather than mocked.
/Services involved