A subscription looks like a price and a renewal date. Underneath, it is a long-running contract that changes state on its own schedule: trials end, cards expire, customers upgrade on the 17th, usage accumulates, some renewals fail, and finance needs to know how much of the cash collected today has actually been earned. Every one of those events must change what the customer can access, what they are charged, and what the books say, consistently.

This is the reference our streaming, SaaS, client-portal and fitness articles link to when they say "subscription". It follows the money through a subscription's life, from the first gate a visitor hits to the revenue line on a monthly report, and covers the architecture decisions at each step: what to build, what to rent, and where the source of truth must live.

Billing decides what a customer owes. Entitlements decide what they get. Products that let one stand in for the other end up giving things away or locking out people who paid.

Three Checks at Every Door

Every request in a paid product passes three different checks, and conflating them causes most subscription bugs:

CheckQuestionSource of truthExample failure when it is mixed with another
AuthenticationWho is this?Identity provider, sessions, tokensTreating "logged in" as "paid", so a lapsed account keeps premium access
AuthorisationMay this person do this, here?Roles and permissions within the accountPlan-specific roles ("Pro admin") that break on every plan change
EntitlementHas this account bought this?Subscription state, plan, add-ons, usage balanceChecking plan === 'pro' in code, so a new plan or a custom enterprise deal requires a deploy

Authorisation is covered in depth in our RBAC reference. This article is about the third row, and about the billing machinery that feeds it.

Plans Are Price Tags; Entitlements Are the Product

The catalogue has two layers that should never be merged. Prices are commercial: amount, currency, billing interval, trial length. Entitlements are functional: which features are on, which limits apply, which allowances refill each period. A plan connects one to the other.

EntitlementTypeStarterTeamEnterprise
reports.exportBoolean featureOffOnOn
seatsLimit325Per contract
projectsLimit5UnlimitedUnlimited
ai.creditsMetered allowance, refills monthly1002,000Per contract
ssoBoolean featureOffAdd-onOn

The application then asks an entitlement service questions like entitled(account, 'reports.export') or remaining(account, 'ai.credits'), and never asks which plan the account is on. That one rule makes the rest of the commercial model flexible:

  • Enterprise deals are configuration. A customer who negotiated 60 seats and SSO gets an override on their account, not a new plan in code.
  • Prices are versioned, never edited. When the Team plan's price rises, existing customers stay on the old price version until you decide to migrate them. Editing a price in place silently re-prices every renewal.
  • Add-ons stack. Entitlements from the base plan and each add-on are merged into one effective set per account.
  • Limits are checked where things are created. The seat check runs when an invitation is sent, not on a nightly audit, and its error message tells the admin how to get more seats.
  • Downgrades need a rule for excess. When an account with 12 projects moves to a 5-project plan, decide in advance: the extra projects become read-only, the customer chooses which to archive, or the downgrade is blocked until they do. Each is defensible. Discovering the question in production is not.

The First Charge and the Trial Before It

The money's journey usually starts before any money moves, with a trial. Trial design is a commercial decision with architectural consequences:

Trial typeHow it worksTrade-off
No card requiredFull access for a period; payment details requested at the endMore sign-ups, lower conversion; needs an explicit trial-ending flow
Card requiredPayment method collected up front; first charge at trial end unless cancelledFewer sign-ups, higher conversion; needs clear reminders before the first charge
FreemiumA permanent free tier with limited entitlementsNo end date to manage; the limits must be generous enough to be useful and tight enough to upgrade from
Reverse trialPremium entitlements for a period, then a drop to the free tier instead of a lockoutUsers experience what they lose; requires downgrade handling for data created on premium features

What happens when the trial ends should be modelled as a sequence, not a date check scattered through the code:

  1. A few days before the end, remind the user, and for card-required trials, state the amount and date of the first charge.
  2. At the end, attempt conversion: charge the stored payment method, or prompt for one.
  3. On success, the subscription becomes active and entitlements switch from trial to paid, usually with no visible change.
  4. On failure or no payment method, apply the chosen expiry rule: downgrade to free, read-only access for a grace period, or suspension.
  5. Never delete trial data at expiry. Customers sometimes return days or weeks after a trial ends, and one who finds an empty account has little reason to start again.

In the European Economic Area and the UK, Strong Customer Authentication rules mean the customer may need to authenticate when a card is first saved or charged. Later renewals charged without the customer present rely on that original authorisation, and the payment provider may still ask the customer to authenticate again, so the product needs a flow to bring them back to complete it.

Mid-Cycle Changes and the Arithmetic of Proration

Customers change plans on arbitrary days, and proration decides what that costs. An illustrative example with simple numbers: a customer on a 30-dollar monthly plan upgrades to a 90-dollar plan with 20 days of a 30-day period remaining.

  • Credit for the unused part of the old plan: 20 / 30 × 30 = 20 dollars.
  • Charge for the remaining part of the new plan: 20 / 30 × 90 = 60 dollars.
  • Net due now: 40 dollars. From the next period, the full 90.

The arithmetic is easy. The policy around it is where products differ, and it should be written down before the first customer asks:

ChangeCommon policyWhy
UpgradeImmediate, prorated charge now or on the next invoiceThe customer wants the feature today; charging now reduces the risk of unpaid upgrades
DowngradeAt the end of the current periodAvoids refunds and avoids removing access the customer has already paid for
Adding seatsImmediate, proratedSame as an upgrade; some products true up seat counts periodically instead
Removing seatsAt period endPrevents add-and-remove cycling to avoid charges
Monthly to annualImmediate, credit the unused monthA larger commitment the customer is ready to make now
Annual to monthlyAt the annual renewalMid-term refunds of annual plans are a support and accounting burden

Small details still need decisions: whether proration is calculated by day or by second, how rounding is applied to each line, and whether a credit larger than the new charge is refunded or carried forward as account balance. Billing providers make each of these configurable; the product team has to choose.

Metering Usage You Can Defend on an Invoice

Usage-based pricing (per API call, per gigabyte, per message, per AI credit) adds a pipeline between product activity and the invoice, and every number on that invoice may be questioned. The pipeline that survives disputes:

  1. Emit usage events at the source, each with a unique id, the account, the meter, the quantity and the time the usage happened, not the time it was processed.
  2. Deduplicate on the event id. Retries in the product will send some events twice; the meter must count them once.
  3. Aggregate per meter with an explicit function: sum (API calls), maximum (peak seats), last value (storage at period end), or unique count (active users).
  4. Close each billing period with a cutoff. Events arriving after the invoice is finalised are billed in the next period as an adjustment, never by editing a finalised invoice.
  5. Show customers the same numbers. A usage page with daily breakdowns, drawn from the same aggregates as the invoice, prevents most disputes before they start.

Metering also has to answer a real-time question billing does not: may this request proceed? Prepaid credits and hard caps must be checked before the work happens, from a fast counter, while the authoritative meter is reconciled afterwards. Soft limits (notify, then bill overage) and hard limits (stop at the cap) are both legitimate; the choice belongs on the plan, as an entitlement, not hidden in code.

When the Card Fails: Dunning as a Workflow

Recurring payments fail for ordinary reasons: expired cards, insufficient funds, bank fraud rules, replaced cards. Recovering them, called dunning, is a workflow with a timeline, and it should be modelled as one:

State diagram of a subscription: trialing converts to active; a failed renewal makes it past due, then restricted, then canceled when dunning is exhausted. A successful retry returns past due to active, and an active customer can pause, where offered, or cancel.
A failed renewal moves through past due and restricted; a successful retry restores the plan instantly.
Subscription stateMeaningEntitlements
TrialingIn a trial, not yet chargedTrial set
ActivePaid and currentFull plan
Past dueA renewal payment failed; retries in progressFull plan during a grace period, with a visible banner
RestrictedGrace period over, still unpaidRead-only or reduced; data intact
PausedCustomer-initiated pause, where offeredReduced or none; resumes on a date
CanceledEnded, by the customer or after dunning exhaustedFree tier or none; data retained per policy

The mechanics that recover the most revenue:

  • Distinguish decline types. A soft decline such as insufficient funds is worth retrying over several days. A hard decline, such as a card reported stolen, will not succeed on retry and needs a new payment method.
  • Keep card details current automatically. Card networks run account-updater services that pass on new expiry dates and replacement card numbers; most payment providers can enable them.
  • Tell the customer, through the right channel. Payment-failed emails belong to the billing category in the notification system, sent to billing contacts rather than every user, with a link straight to the update-payment page. Our notification systems reference covers that routing.
  • Restore instantly on recovery. The moment a retry succeeds, entitlements return. A customer who pays and remains locked out until a nightly job runs will contact support, and should.

Failed renewals are usually reported as involuntary churn. Unlike customers who chose to leave, these customers still wanted the product, which is why dunning deserves the same engineering attention as the checkout.

Rent the Billing Engine, Own the Entitlements

Subscription billing providers such as Stripe Billing, Chargebee and Recurly handle invoicing, proration, payment retries, card storage and much of the dunning described above. Merchant-of-record services such as Paddle go further and become the legal seller, taking on sales tax and VAT collection and remittance. For almost every product, building these from scratch is the wrong use of engineering time.

What should stay in your own system is the part your product logic depends on:

ConcernUsually the provider'sUsually yours
Prices, invoices, proration, payment retriesYesA mirrored copy for reporting
Card data and payment methodsYes; keeping card numbers out of your systems keeps most PCI DSS scope with the providerOnly tokens and display details
Tax calculationYes, through the provider's tax product, a tax service, or a merchant of recordThe customer's location and tax id
Entitlements and limitsNoYes: derived from subscription state, checked on every request, never by calling the provider live
Usage counters for real-time limitsNoYes; the provider receives aggregated usage for invoicing

The link between the two is the provider's webhooks, and they deserve careful handling. Verify every signature, and process idempotently by event id, because events are retried.

Do not assume they arrive in order: re-fetch the current subscription from the provider's API when an event arrives, rather than applying the event's payload blindly. And run a periodic reconciliation that compares every subscription in your system with the provider's record, because a missed webhook is otherwise a customer who paid and has no access, or one who stopped paying and still does.

Revenue Is Earned, Not Collected

Cash and revenue are different numbers. A customer who pays 1,200 for a year on the 1st of January has given you 1,200 in cash, but under accrual accounting the revenue is earned as the service is delivered, roughly 100 each month, with the unearned remainder held as deferred revenue. The accounting standards that govern this, ASC 606 in the US and IFRS 15 internationally, recognise revenue as the obligations to the customer are satisfied.

The accounting policy is your finance team's decision, made with their advisers. The system's job is to make that policy possible, which means storing the right detail from the start:

  • A service period on every invoice line, with a start and end date, so each line can be spread across the months it covers.
  • Separate lines for separate obligations: subscription fee, setup fee, usage, add-ons. They may be recognised differently.
  • Credit notes, never edited invoices. A correction is a new document referencing the original, so revenue already reported can be adjusted rather than silently changed.
  • Refunds and proration credits linked to the lines they offset, so their effect on earned and deferred revenue can be calculated.
  • Exports at line level to the accounting system or a revenue-recognition tool, rather than invoice totals that cannot be split.

Billing Tenants, and Tenants Who Bill Their Own Customers

Multi-tenant platforms often have two layers of billing, and confusing them is expensive:

  1. You bill your tenants. A fitness studio, a law firm or a publisher pays you for the platform, by plan, seats or usage. This is the subscription model described so far, attached to the tenant account. How tenants are isolated in the first place is covered in our multi-tenant architecture article.
  2. Your tenants bill their own customers. The studio sells memberships, the publisher sells subscriptions to readers, the firm bills retainers through a client portal. Now each tenant needs its own catalogue, its own customers and its own payouts, inside your product.

The second layer raises questions that must be answered before building it:

  • Who is the merchant? With connected-account models such as Stripe Connect, each tenant can be the merchant for its own sales while your platform orchestrates payments and takes a fee. The answer decides who handles disputes, refunds and tax.
  • How do platform fees work? A percentage of each payment, a fixed fee, or both, and whether they appear on the tenant's statements.
  • Who carries chargebacks? Disputes arrive weeks after a payment; the model must say whose balance they come from.
  • Who pays for whom inside an organisation? Account hierarchies, where a parent organisation pays for several workspaces, need consolidated invoicing while each workspace keeps its own entitlements.

Membership Platforms Have Rules Subscriptions Don't

Media, streaming, fitness and community products layer consumer-specific rules on the same foundation. Each is an entitlement or a billing rule, not a special case in the player or the paywall:

  • Metered paywalls. A number of free articles per month for anonymous or registered readers is an entitlement with a counter, tied to a device or account, with the accepted reality that a determined reader can reset an anonymous meter.
  • Concurrent stream limits. Two simultaneous streams on one plan and four on another is a limit enforced by a session registry, with a defined behaviour when a new device starts playing. We cover the streaming side in our OTT launch article.
  • Household and family plans. One payer, several profiles or members, each with their own preferences and possibly age restrictions.
  • Gift subscriptions and vouchers. Prepaid periods with no renewal by default, redeemed by someone other than the buyer.
  • Pauses and holds. Common in fitness memberships; the pause must stop both billing and the renewal clock, and resume cleanly.
  • Purchases through app stores. Subscriptions bought through Apple's App Store or Google Play are billed by those stores, which notify your server of renewals, cancellations and refunds through App Store Server Notifications and Google Play Real-time Developer Notifications. A customer may subscribe on the web and on a phone; the entitlement service must merge both sources so access is consistent wherever they sign in.

Publishers and streaming businesses meet most of these at once, which is why we treat them as a distinct pattern in our media and entertainment work.

The Numbers a Subscription Business Runs On

Subscription metrics are only reliable if they are computed from the subscription event history (every start, change, renewal, failure and cancellation) rather than from snapshots of the current state. With that history, the standard metrics are well defined:

MetricDefinitionCommon mistake
MRRNormalised monthly value of active recurring subscriptionsIncluding one-time fees or usage overages; not normalising annual plans to a monthly value
MRR movementsNew, expansion, contraction, churned and reactivated MRR for the periodReporting only the net change, which hides heavy churn behind strong sales
Logo churnShare of customers who cancelled in the periodCounting downgrades as churn, or trials that never converted
Revenue churn and net revenue retentionLost MRR, and MRR retained from a cohort including expansionMixing cohorts, so new sales mask losses in existing accounts
Trial conversionShare of trials that become paid within a defined windowIgnoring late conversions after the trial ends
Involuntary churnCancellations caused by failed payments after dunningMerging it with voluntary churn, which hides a fixable problem

Each of these is a metric definition in the sense of our reporting and analytics reference: defined once, with its grain, time attribute and exclusions, and reconciled against the billing provider's records so finance, product and the board all see the same number.

Subscription platforms reward getting the foundations right early, because every later pricing experiment runs on them. Entitlements, webhooks, dunning and revenue data are part of how we approach web application development for subscription products. If you are designing a subscription or membership platform, or untangling one that has outgrown its first version, we would be glad to work through it with you.

Frequently Asked Questions

What is the difference between billing and entitlements in a subscription platform?

Billing decides what a customer owes; entitlements decide what they get. Prices are commercial (amount, currency, interval and trial length), while entitlements are functional: which features are on, which limits apply and which allowances refill each period. The application should ask an entitlement service whether an account may do something, never which plan it is on, so enterprise deals become configuration rather than code.

Should I build my own subscription billing system?

For almost every product, no. Providers such as Stripe Billing, Chargebee and Recurly handle invoicing, proration, payment retries, card storage and much of the dunning process, and merchant-of-record services such as Paddle also take on sales tax and VAT. What should stay in your own system is the part your product logic depends on: entitlements and limits derived from subscription state, plus real-time usage counters.

How does proration work when a customer upgrades mid-cycle?

The customer is credited for the unused part of the old plan and charged for the remaining part of the new one. Upgrading from a 30-dollar to a 90-dollar monthly plan with 20 of 30 days left gives a 20-dollar credit against a 60-dollar charge, so 40 dollars is due now and the full 90 from the next period. Downgrades commonly take effect at the end of the period.

What is dunning in subscription billing?

Dunning is the workflow for recovering failed recurring payments caused by expired cards, insufficient funds, bank fraud rules or replaced cards. It retries soft declines over several days, asks for a new payment method after hard declines, keeps card details current through account-updater services, emails billing contacts a direct update link, and restores entitlements the moment a retry succeeds, cutting involuntary churn among customers who still wanted the product.

Is subscription cash the same as revenue?

No. A customer who pays 1,200 for a year on January 1 has given you 1,200 in cash, but under accrual accounting the revenue is earned as the service is delivered, roughly 100 a month, with the rest held as deferred revenue. ASC 606 and IFRS 15 govern this. The system's job is to make your finance team's policy possible: a service period on every invoice line, and credit notes instead of edited invoices.

Sources