Back to blog

Usage-Based Billing Architecture: The Metering System Most SaaS Teams Build Twice

Usage-Based Billing Architecture: The Metering System Most SaaS Teams Build Twice

Somewhere between the first paying customer and the Series A pitch deck, most SaaS teams hit the same wall: the pricing model that got them to market — flat monthly seats, maybe three tiers — stops matching how customers actually use the product. Usage-based billing, where customers pay based on consumption (API calls, minutes processed, messages sent, storage consumed) instead of a fixed seat count, becomes the obvious next step. What's far less obvious is that the metering system required to bill accurately on usage is a distributed systems problem wearing a finance costume. AEGONTECH LLC has rebuilt usage-based billing infrastructure for clients who shipped it once, got the numbers wrong, and had to do it again — which is why we treat billing architecture as a first-class engineering decision, not a checkbox you tick when you wire up a payments SDK.

This post is for the CTOs, VPs of Engineering, and founders who are staring at a pricing-model change on the roadmap and assuming it's a two-sprint job. It usually isn't. Get the architecture right the first time, and usage-based billing becomes a durable growth lever. Get it wrong, and you'll spend a quarter of next year's engineering capacity rebuilding it under revenue-recognition pressure from finance.

Key Takeaways

  • Usage-based billing is fundamentally a data pipeline problem — event collection, deduplication, and aggregation — before it's ever a billing problem.
  • OpenView's SaaS Benchmarks research has tracked a steady rise in hybrid and consumption pricing, with roughly 45% of software companies now running some form of usage-based model, up from about a third just two years earlier.
  • Idempotency (the guarantee that processing the same event twice produces the same result once) is the single most-skipped requirement in first-pass metering systems, and it's the one that causes the angriest customer support tickets.
  • Build-vs-buy for billing infrastructure is rarely all-or-nothing: most mature architectures buy the ledger and invoicing layer (Stripe Billing, Orb, Metronome) and build the metering and entitlement layer in-house, where domain logic actually lives.
  • Entitlement checks (does this customer's plan currently allow this action) need to run in the request path in milliseconds, which means they cannot depend on your billing provider's API being available or fast.

Why Does Usage-Based Billing Break Traditional SaaS Architecture?

It breaks traditional architecture because seat-based billing only needs to know who a customer is, while usage-based billing needs to know what happened, when, exactly once, and at what volume — for every single billable action, at whatever scale your product runs. A flat-seat SaaS product can get away with a monthly cron job that counts active users in PostgreSQL and syncs it to Stripe. A usage-based product processing millions of billable events a day needs an event pipeline that looks a lot more like an analytics platform than a billing system.

That shift catches teams off guard because the skill set is different. The engineers who built your subscription checkout flow are not automatically the engineers who should design an event-driven architecture (a system where services communicate by emitting and reacting to events, typically through a message queue or stream, rather than calling each other directly) capable of ingesting, deduplicating, and aggregating usage events without losing or double-counting a single one. Lose events and you underbill, which finance notices in the reconciliation report. Double-count events and you overbill, which your angriest customer notices first, screenshots, and posts about.

Inline blog image 1

Build vs Buy: Should You Build Your Own Metering Engine?

No — not the whole thing, and not from scratch. The honest answer AEGONTECH gives clients, after doing this repeatedly for teams across fintech, media, and communications products, is a hybrid: buy the parts that are genuinely commoditized (invoicing, tax calculation, payment retry logic, dunning emails) and build the parts that encode your actual business logic (what counts as a billable event, how usage aggregates across a billing period, what happens when a customer crosses a plan threshold mid-cycle).

Providers like Stripe Billing, Orb, and Metronome have gotten good at the ledger-and-invoice layer over the last few years — accurate proration, tax compliance across jurisdictions, dunning workflows that actually recover failed payments. Building that yourself in 2026 is usually a bad trade; you're reinventing tax compliance, which is its own regulatory minefield. But the metering layer — the code that decides a webhook delivery, an API call, or a minute of transcoded video is billable, and reconciles that against what the customer's plan allows — is domain-specific enough that off-the-shelf tools rarely fit without significant customization. That's the part worth building in-house, and it's the part most teams underestimate.

The comparison that matters isn't "build vs buy" as a binary. It's "which layer is commodity infrastructure and which layer is your product's actual pricing logic" — and drawing that line correctly is an architecture decision, not a procurement decision.

What Does a Production-Grade Metering Pipeline Actually Look Like?

It looks like an append-only event log feeding an idempotent aggregation layer, not a counter you increment in the request handler. Every billable action — an API call, a message sent, a render job completed — gets emitted as an immutable event with a unique event ID, a timestamp, a customer identifier, and a quantity. That event lands in a durable queue (Kafka, AWS Kinesis, or even a well-indexed PostgreSQL table for lower-volume products) before anything downstream touches it.

The aggregation layer then does the unglamorous but critical work: deduplicating by event ID so a retried request or a network blip never double-bills, bucketing events into billing periods that respect the customer's actual cycle (not always the calendar month), and exposing running totals so both your application and your customer's usage dashboard can query current consumption without hitting the billing provider's API on every page load. This is where idempotency stops being an academic term from a systems design interview and becomes the property that determines whether your support team spends next Tuesday explaining a duplicate charge.

We've architected this pattern for clients building on Node.js and Python backends alike, with PostgreSQL as the system of record for aggregated usage and a message queue absorbing the event volume upstream — the same pattern, notably, that underlies the API traffic AEGONTECH's own products like Dolfy.ai and Mimicall.app handle daily, just pointed at a billing ledger instead of a feature. Containerization (packaging an application with its dependencies into a portable unit, typically with Docker) and orchestration via Kubernetes matter here mainly for one reason: the aggregation workers need to scale horizontally during usage spikes without losing exactly-once processing guarantees, and stateless containers behind a queue make that tractable.

Inline blog image 2

How Do Entitlements and Feature Gating Fit Into Billing Architecture?

Entitlements answer a different question than metering does: not "how much did this customer use," but "is this customer currently allowed to do this at all." That check has to run in the hot path of your application — before an API call executes, before a video renders, before a message sends — which means it cannot be a network call to your billing provider on every request. Latency and availability requirements for entitlement checks look more like authentication than like accounting.

The pattern that holds up in production is a local, frequently-refreshed cache of plan limits and current usage, sitting in front of the request path, with the metering pipeline updating it asynchronously. Feature flags and progressive delivery tooling (systems that let you toggle functionality for specific users or cohorts without a deploy) often end up sharing infrastructure with entitlement checks, because both answer "should this specific request see this specific behavior" at similar latency budgets. Teams that treat entitlements as an afterthought bolted onto the billing system tend to ship a product where a customer who's hit their plan limit gets a confusing 500 error instead of a clear upgrade prompt — a UX failure that costs more in support tickets and churn than the engineering time it would have taken to build the check correctly.

What Are the Compliance and Financial-Accuracy Risks Nobody Mentions Upfront?

The biggest risk is that inaccurate usage metering becomes a revenue-recognition problem, not just an engineering bug — and that turns your billing pipeline into audit-relevant infrastructure. If your metering system undercounts or overcounts usage, your finance team's monthly close is wrong, and if you're pursuing SOC 2 (a security compliance framework auditors use to verify a company's controls around data handling, availability, and processing integrity) or preparing for due diligence ahead of a fundraise or acquisition, an unreliable billing pipeline is exactly the kind of finding that shows up in a technical due diligence report and slows a deal down. We've seen this firsthand doing due-diligence-adjacent architecture reviews: a billing system with silent double-counting or dropped events isn't just a customer trust problem, it's a documented control weakness.

The fix isn't exotic — it's the rigor AEGONTECH applies to any client billing rebuild: the same discipline you'd apply to any financial system: an audit log that lets you reconstruct exactly why a customer was charged a given amount for a given period, reconciliation jobs that compare raw event counts against invoiced totals and alert on drift, and a clear owner (usually a senior backend engineer, not "whoever's free") for the metering pipeline's correctness. Treat billing accuracy with the same seriousness as authentication and authorization architecture — because a security vulnerability and a billing bug both erode the same thing: whether customers trust you with their account.

FAQ

Do we need usage-based billing if seat-based pricing is working fine? Not necessarily. If your product's value scales cleanly with seats — more users genuinely means more value delivered — seat-based pricing can remain the right model indefinitely. Usage-based billing solves a specific problem: value that scales with consumption (API calls, compute, storage, messages) rather than headcount, where seat-based pricing either underprices heavy users or overprices light ones.

How long does it actually take to build a production-grade metering system? For a team building it correctly the first time — event-driven pipeline, idempotent aggregation, entitlement caching — four to six weeks of focused engineering time is a realistic estimate for a first production version, assuming the team already has message-queue infrastructure. Teams that retrofit it after launching with an inadequate counter-based approach routinely spend three to six engineering-months unwinding and rebuilding, because by then the inaccurate data has already propagated into customer invoices and finance reports.

Can we just use Stripe's built-in metered billing and skip building our own pipeline? For low-volume or simple usage dimensions, yes — Stripe's metered billing API can be a legitimate full solution. It becomes insufficient once you need sub-second entitlement checks in your application's request path, custom aggregation logic across multiple usage dimensions, or usage data exposed in a customer-facing dashboard in near real time, at which point you need your own metering layer feeding Stripe as the invoicing backend rather than relying on Stripe alone.

What's the single biggest mistake teams make when building this? Treating the metering pipeline as a counter in application code instead of an event-sourced system with an immutable audit trail. A counter that increments in the request handler cannot be safely retried, cannot be reconciled after the fact, and cannot answer "why was this customer charged this amount" six months later when finance or a customer asks.

Usage-based billing architecture is a genuinely hard distributed-systems problem, and treating it as one from the start is what separates teams that scale their pricing model smoothly from teams that rebuild it under pressure a year later. If your team is evaluating a move to usage-based or hybrid pricing and wants a second set of eyes on the architecture before you build, AEGONTECH LLC works with engineering teams on exactly this kind of infrastructure decision — reach out through aegontech.dev to set up a consultation and walk through your specific usage model before you write the first line of the metering pipeline.