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 derived from billing state
Access resolved from the subscription rather than copied into a flag at checkout. The copy is always correct until the first failed payment, then it is silently wrong for everyone it happened to.
Grace periods and dunning
A payment failure should degrade access, not detonate it. Most involuntary churn is a recoverable card treated as a cancellation.
Webhook handling
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.