Subscription & Billing Lifecycle
Billing is a state machine wearing a pricing page. Almost every unpleasant subscription bug is a state nobody drew — a failed renewal, a mid-cycle downgrade, a card that recovers three days late.
How I use it
Entitlement that drifts out of sync
Access derived from billing state rather than copied into a flag at checkout. The copy is always correct until the first failed payment, and then it is silently wrong for everyone it happened to.
A failed card churning a good customer
Explicit grace windows and dunning so a payment failure degrades access instead of detonating it. Most involuntary churn is a recoverable card treated as a cancellation.
Webhooks that arrive twice, or backwards
Stripe and Square webhooks handled idempotently and ordered by event rather than arrival. They will duplicate and they will race, and both are the receiver’s problem to solve.
What I use
- Stripe
- Square
- PostgreSQL
- Drizzle ORM
Related skills
Want the detail behind any of this?
I can walk through any of it in as much depth as you want.