SaaS Billing - The Complete Guide (2026)

SaaS billing is the system that turns a subscription or usage event into money — and it is a lot more than charging a card. You need to store plans, track subscriptions, meter usage, handle webhooks idempotently, recover failed payments, and keep entitlements accurate at every step. Get it wrong and you either miss revenue or break customer access. Here's the complete guide for 2026.
Quick Answer
SaaS billing is the system that turns a subscription or usage into money: it stores plans, creates and tracks subscriptions, meters usage, generates invoices, processes payments through a provider like Stripe, and reacts to webhook events such as successful charges and refunds. The hard parts are not charging a card — they are handling webhooks idempotently, metering usage accurately, and recovering failed payments. This guide covers the full anatomy and links to the build guides for each piece.
What SaaS billing is
SaaS billing is the end-to-end system that manages plans, subscriptions, usage, invoices, and payments for a software product. It connects three things: your pricing (what you charge), your payment provider (who moves the money), and your database (what each customer is entitled to right now).
The building blocks
Component | What it does | Build guide |
|---|---|---|
Plans / pricing | Defines tiers, prices, and limits | SaaS pricing models |
Subscriptions | Recurring charge + lifecycle (trial, active, canceled) | subscription billing |
Usage metering | Counts billable events for usage pricing | usage-based billing |
Checkout | Collects payment securely | Stripe + Next.js |
Webhooks | Provider tells your app what happened | this guide |
Entitlements | What the customer can access now | this guide |
Dunning | Recovers failed payments | this guide |
Subscriptions vs usage
Most SaaS billing is one of two shapes, often combined:
Subscription (flat/tiered): a predictable recurring charge for a plan. See subscription billing.
Usage-based (metered): charge for what the customer consumes — API calls, credits, seats. See usage-based billing.
Pick the model that matches the value the customer gets. Many products use a base subscription plus metered overage.
Why webhooks and idempotency are the hard part
Your app never trusts the browser to confirm a payment. Instead, the payment provider sends a webhook (e.g. Stripe's checkout.session.completed) to your server, and your server grants access. Two rules make this reliable:
Verify the signature so you know the event is really from the provider.
Process each event idempotently — providers retry, so the same event can arrive twice. Record processed event ids and skip duplicates.
This illustrative handler shows the idempotency shape (untested-here: illustrative, not run in a sandbox for this guide):
export async function handleWebhook(event) {
if (await alreadyProcessed(event.id)) return; // dedup
await markProcessing(event.id);
if (event.type === 'checkout.session.completed') {
await grantEntitlement(event.data.object); // provision access
}
await markProcessed(event.id);
}Failed payments and dunning
Cards fail. A billing system should detect failed renewals, retry on a schedule, email the customer, and downgrade or lock access only after a grace period. Recovering these payments is one of the highest-leverage things a SaaS can do for revenue.
How FastStaq does billing
FastStaq integrates real payment providers rather than being "billing software" you buy. It ships a pluggable gateway that selects Stripe or Lemon Squeezy via a single environment variable, with a shared, idempotent provisioning path that creates the subscription, grants entitlements, and records revenue. Webhook events are de-duplicated through dedicated idempotency ledgers (StripeEvent / LemonSqueezyEvent), and a credits model supports usage-style metering. Plans, subscriptions, and entitlements are first-class database models.
Frequently asked questions
What is SaaS billing? The system that manages plans, subscriptions, usage, invoices, and payments for a software product.
Do I need Stripe to build SaaS billing? You need a payment provider; Stripe is the most common, but Lemon Squeezy, Paddle, and others work too. See Stripe alternatives.
Why are webhooks so important? They are how your app learns a payment succeeded. Treat them as the source of truth and make them idempotent.
Next steps
How to integrate Stripe with Next.js
How subscription billing works
How to implement usage-based billing
SaaS pricing models explained
How much does Stripe cost and Stripe vs Lemon Squeezy vs Polar
Back to the SaaS boilerplate guide


