Migrated a B2B SaaS platform from flat-rate Stripe billing to usage-based pricing — zero downtime, zero revenue loss during migration.
A B2B SaaS company had outgrown their flat-rate pricing model. Customers using 10× the average were paying the same as light users — and churning high-value customers who felt underserved. They needed usage-based billing, but had 340 active subscriptions, a complex multi-tenant Django app, and a non-negotiable requirement: no downtime, no billing disruptions.
A complete Stripe billing layer rebuild, migrating from stripe.Subscription with flat prices to stripe.Subscription with metered usage items.
The key insight: Stripe supports multiple price items on a single subscription. I used this to run a parallel billing period:
This gave a 30-day migration window where both systems were running. If anything broke, we could revert by removing the metered item.
Celery workers capture usage events from the application (API calls, data processed, active seats) and batch-write to Stripe’s Usage Records API every hour. Redis buffers in-progress events to handle API rate limits.
New billing dashboard built on Stripe’s embedded components + custom React UI showing current usage, projected invoice, and plan limit warnings.
Usage events must be idempotent. If a Celery worker crashes mid-batch, you can’t double-count usage. I implemented a Postgres-backed idempotency key system: every event has a UUID, and the worker checks against a deduplication table before writing to Stripe.
30 minutes, free, no deck. We'll figure out if I'm the right fit for your project.