Skip to main content

What are you looking for?

Explore our services and discover how we can help you achieve your goals

Building a subscription billing and entitlement system

Design subscription billing and entitlements as two linked systems: a billing path that turns a plan into a charge and an invoice, and an entitlement layer that turns the same plan into an enforced feature or usage limit. Connect them with subscription-change events, not hand-copied state, so a plan change, a failed payment or a cancellation updates access immediately.

Book a solution review See the related solution

By Netbase Commerce and Platform Engineering Desk · Reviewed by David (CEO) · Updated · 11 min read

star

This guide is for SaaS founders, CTOs and engineering leads scoping a first or next billing build, once the product has a pricing model to charge for. Our SaaS platform engineering guide covers the wider platform; this spoke goes deeper into the billing and entitlement system itself, after tenants are defined (multi-tenant SaaS architecture) and the MVP module list names billing as a line item (SaaS MVP architecture roadmap).

In this guide

Billing and entitlements are two systems, not one

A billing system answers "what does this customer owe, and have they paid it": plans, prices, invoices, payment methods, taxes and refunds. An entitlement system answers a question asked far more often: "can this customer use this feature right now, and how much is left." The two must agree, but they are not the same code path. Billing runs on a monthly or annual schedule and tolerates seconds of latency; entitlement checks run on every request and need to return in milliseconds. Treating them as one tangled module is the most common reason the two drift: a plan downgrade updates the invoice but not the feature flag, or a cancelled subscription keeps access live for days.

How do billing state and entitlements stay in sync?

They stay in sync through events, not through a second system reading the first system's database. When a subscription is created, renewed, upgraded, downgraded, paused or cancelled, the billing system emits an event; an entitlement-update step consumes it and recomputes what the customer may access, independent of whatever triggered the change. Stripe's own Billing documentation describes this directly: an active subscription creates an active entitlement for each feature attached to the purchased product, and the application should check that entitlement, never the plan name, to decide what a customer can do. The practical rule follows: never let product code ask "is this customer on the Pro plan"; ask "does this customer have the export-to-CSV entitlement, and how many rows are left," because the plan can be renamed or overridden by a contract while the entitlement question stays stable.

The data model: five objects, one dependency chain

  • Plan

    Holds
    Name, price, billing interval, included features and limits
    Changes when
    A pricing change ships, rarely for an existing customer
  • Subscription

    Holds
    Which plan a customer is on, its status and renewal date
    Changes when
    Upgrade, downgrade, pause, cancellation, trial end
  • Invoice

    Holds
    What was charged for a billing period, and whether it was paid
    Changes when
    Each billing cycle, and on every payment attempt
  • Usage record

    Holds
    Metered consumption of a feature, tied to a billing period
    Changes when
    Every metered event (an API call, a seat, a generated report)
  • Entitlement

    Holds
    What the subscription currently grants, computed from the plan plus any override
    Changes when
    Every subscription or override change, read on every access check

Keep the entitlement table narrow: a feature key, a limit or boolean, and the subscription it belongs to. Resist letting it carry pricing logic; pricing lives in the plan and invoice, access rules live in the entitlement. An enterprise contract that negotiates a custom limit becomes an override row on one subscription, not a new plan, so the base plan catalog stays small and readable.

Build vs buy: a decision framework

Route Strength Risk Choose it when
Build on a payments API directly (cards, invoicing, webhooks) Full control of pricing logic and the entitlement model You own the lifecycle, retry logic and every edge case (proration, trial-to-paid, tax) Pricing is a core differentiator, or plans are too unusual for a billing platform's model
Adopt a subscription billing platform (Stripe Billing and comparable products) Lifecycle, invoicing, tax and retries are handled; entitlements can be read from the platform Your pricing model must fit the platform's plan and metering model, or you build a translation layer Plans are standard (tiered or per-seat, with or without metered add-ons) and time-to-market matters most
Hybrid: billing platform for payment and invoicing, your own entitlement service Keeps payment compliance scope (PCI DSS) with the platform while entitlement logic stays product-specific Two systems to keep in sync; the event pipeline between them must never fail Pricing has product-specific rules (bundles, usage caps, contract overrides) a billing platform's plan model cannot express cleanly

None of the three removes the need for an entitlement check in the product code; a billing platform computes what a plan should grant, but only the product knows which code path needs that answer.

Metering and usage-based pricing

Usage-based and hybrid pricing (a base fee plus metered overage) need a usage record that is idempotent and attributed to the right billing period before it reaches an invoice. Two rules keep this reliable: give every usage event a unique identifier so a retried write does not count twice, and roll usage up to the entitlement layer continuously, not only at invoice time, so a customer hits a hard limit before an invoice needs to say so. The entitlement layer, not the invoice, enforces the limit in real time; the invoice then reports what the entitlement layer already allowed.

A sequencing plan for a billing and entitlement build

  1. Model the plan catalog first

    , including every feature flag and usage limit per plan, before writing any billing integration code.

  2. Separate the entitlement table from the plan table

    , so a contract override or a grandfathered plan is one row, not a new plan definition.

  3. Pick the billing route

    from the build-vs-buy table above, based on how standard the pricing model is and how much lifecycle logic you want to own.

  4. Build the webhook-to-entitlement pipeline before launch

    every subscription-change event must update entitlements, and every entitlement check must read that table, never the plan name.

  5. Decide the failed-payment policy up front

    pause, mark unpaid, or cancel, and after how many retries, since this is a retention decision, not only a technical setting.

  6. Test the lifecycle, not just the happy path

    trial-to-paid conversion, downgrade mid-cycle, a card decline on renewal, and a cancel-then-resubscribe within one billing period.

  7. Reconcile on a schedule

    compare active subscriptions against active entitlements daily, so a missed webhook is caught before a customer notices.

Where AI fits in a billing and entitlement build

AI has a narrow role here: it never decides whether a charge succeeds or an entitlement is granted, both of which must stay deterministic and auditable. Netbase works with the major commercial and open-source AI models, chosen per project. Each item below states how mature it is at Netbase.

What delivery record exists, and what does not

Netbase has built recurring, subscription-style billing inside a client product and carries financial and ERP modules inside its own and a client's SaaS platforms:

  • Dey Page. A multi-state business directory where Featured Listing placements and a field-verification badge are sold as subscriptions, charged through the Paystack and Flutterwave payment gateways (Dey Page record).
  • Cloodo Workspace. A Netbase Business Division digital workplace whose Cloud ERP module includes financial functions alongside CRM, HRM and AI modules in one workspace (Cloodo record).
  • Cloud ERP for a US client (not named). Since 2020, offshore development and managing partner on a multi-tenant cloud ERP delivered as SaaS; its planned second phase covers financial management and reporting alongside point of sale, inventory and loyalty (cloud ERP record). This phase is described as planned, not delivered.

What does not exist. No published Netbase record describes a standalone metering or entitlement engine, a migration from one billing model to another (seat-based to usage-based, for example), or a published duration, cost or conversion figure for any billing or entitlement build. The framework above comes from general delivery practice and Stripe's and the PCI Security Standards Council's published documentation, not from one measured Netbase project.

Alternatives: who builds and runs the billing and entitlement layer

Route Strength Choose it when
Your own team, on a billing platform's API Deepest knowledge of your product's plans and entitlement rules Capacity exists and pricing logic is close to the platform's model
Your own team, built directly on a payments API Full control, no platform plan-model constraints Pricing is unusual enough that a billing platform's plan model would need heavy workarounds
A dedicated engineering partner One team across product code, the billing integration and the entitlement service The build spans several systems at once (product, billing, invoicing, admin tooling) or no team yet owns this layer

In Netbase custom development the client owns the IP created for it, and most projects run on fixed-price contracts agreed after discovery, with milestone-based, monthly team retainer or KPI-linked terms also offered where the scope fits. Netbase's own productized library includes a Cloud ERP module with financial functions, a growth-capability accelerator that can shorten the invoicing and reporting side of a build. The offer sits in SaaS development and web application development, starting from the SaaS product accelerator.

Limits of this guide

  • No billing platform's plan model, pricing API or tax feature is described in full; read its own documentation before committing to it.
  • No duration, cost or conversion figure is claimed; a project's real numbers depend on its pricing model, payment mix and scale.
  • Tax calculation and remittance, chargebacks and revenue recognition are out of scope; each deserves its own specialist review.

Plan the next step with a Netbase consultant

Frequently asked questions

For a single-tier plan, checking the plan name in code can work for a while. Once you add usage limits, contract overrides or more than a couple of plans, drift between what was sold and what is enforced becomes common enough that a narrow entitlement table, updated by billing events, is worth building before it causes a support incident.

Decide in advance whether the subscription pauses, is marked unpaid while retries continue, or is cancelled, and after how many attempts; this is a retention decision, since an immediately cancelled subscription usually requires the customer to resubscribe rather than simply pay the pending invoice.

For a single-plan product, yes, but migrating customers into an entitlement model later is more work than building it narrow from the start, since every historical plan change and override must be reconstructed rather than recorded as it happened.

Only if the plan enforces a hard limit before the billing period ends. A plan that reports overage on the next invoice can meter in batches; a plan that blocks further use once a quota is hit needs the entitlement layer to see usage close to real time.

Next step

Tell us your pricing model, including any usage-based or contract-override cases, and we will book a solution review to scope the billing and entitlement build in the right order. You can also see the SaaS product accelerator solution or browse more Netbase insights.

Web application development with AI built in where it converts Web application development with AI built in where it converts

Netbase provides web application development for product and commerce teams that need fast, maintainable web apps and storefront front ends, with AI search, assistants and automation added where they measurably help. Since 2012 Netbase has worked with 500+ businesses across 80 countries; according to its published case studies, PrintLeo's page load improved 35% and 4over4's conversion rose 48%.

Learn More
line
SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules

A SaaS product accelerator is a set of reusable Netbase modules for accounts, billing, roles and integrations that helps founders and product teams launch subscription software faster, with room for in-product AI from the first release. Reusing these modules can cut development time by up to 60%, and the approach is proven on Printcart, Netbase's own web-to-print SaaS.

Learn More
line

Work with Netbase remotely

Every Netbase engagement is delivered remotely, so clients in any country and any industry can work with us; Netbase has worked with clients in 80 countries. Contracts and invoices are issued by Netbase JSC, and payment is made by bank transfer to Netbase JSC's company account or PayPal Business. Talk to the CEO, Huy Nguyen (David), on WhatsApp or by email.

Contact Netbase

Discuss a project

Netbase JSC helps organizations design, build, modernize, and operate digital products and AI-enabled business systems.
Project enquiries

project@netbasejsc.com

WhatsApp

+84 937 869 689

Office address

91 Nguyen Chi Thanh, Dong Da, Hanoi, Vietnam

Get in touch

Tell us what you want to build, modernize, or operate.

Tell us what you want to build, modernize, or operate.

Contact Netbase