Subscription billing
Charging a saved card on a repeating schedule for as long as the plan lasts, with renewals, plan changes, and failures handled automatically.
See it
What it is
Subscription billing is a small state machine wearing a price tag. A customer agrees once, you vault the card, and the system charges it on a schedule while the plan is alive: trialing, active, past due, canceled, reactivated. Every renewal after the first is an off-session charge, made with nobody at the keyboard.
Reach for it whenever access is ongoing rather than one-off: SaaS seats, memberships, retainers, hosting. The plumbing you actually need is plans and prices, a billing cycle anchor, proration rules for mid-cycle upgrades, cancel-at-period-end so people keep what they paid for, and an entitlements table your app reads instead of asking the processor on every request.
Gotcha: the hard part is not the first charge, it is renewal number fourteen. Cards expire, get reissued, and decline for reasons that have nothing to do with intent, which is involuntary churn, and it quietly eats a few percent of revenue a month unless you add dunning, smart retries, and an account updater. Also: never let a failed payment delete the account. Mirror whatever past-due state the provider reports (you read that status, you do not set it), keep the data, and put access back when the money finally lands.
Ask AI for it
Build recurring billing on Stripe for a two-tier SaaS: define monthly and annual Prices for 'Pro' and 'Team', start subscriptions through Checkout with a 14 day trial, and drive access from the 'invoice.paid', 'invoice.payment_failed', 'customer.subscription.created', 'customer.subscription.updated', and 'customer.subscription.deleted' webhooks into an entitlements table keyed by user. Mirror Stripe's invoice and subscription statuses onto our own records rather than assigning them: Stripe derives 'past_due' itself, so never try to write that status directly. Upgrade immediately with prorations, downgrade at period end, keep the account and its data on a failed renewal with a grace period before access is cut, restore access when a later invoice is paid, and expose Stripe's customer portal for card and plan changes.