Subscription lifecycle
The state machine behind a subscription as it moves through trial, activation, renewal, pause, cancellation, and reactivation.
See it
What it is
A subscription is more than its latest invoice. Its lifecycle carries the agreement through trial, activation, renewal, payment trouble, pause, cancellation, expiration, and reactivation, and tells the product what should happen next.
Model it as an explicit state machine when billing affects access, notifications, revenue, or support workflows. Process provider webhooks into internal transitions, then update entitlements and schedule side effects from those durable state changes.
Provider status names are not your product rules. A cancelled subscription may retain access until period end, and a failed payment may enter a grace period. Make webhook handling idempotent and keep billing state separate from the entitlements a customer can use.
Ask AI for it
Implement a Stripe Billing subscription lifecycle as an explicit state machine with trialing, active, past-due, paused, cancelling, cancelled, expired, and reactivated transitions. Consume customer.subscription and invoice webhooks idempotently, store transition history, separate Stripe status from entitlements, honor cancel_at_period_end, define grace-period access, and run emails and access changes from durable transitions rather than browser callbacks.