Skip to content
lazy devs
5 min readLazy Devs

Usage-based billing for SaaS: building metered and hybrid pricing

Metered and hybrid pricing can fit your product better than a flat plan, but the numbers have to be right every time. Here is how to build metering that does not leak revenue.

Flat monthly plans are the easy case, and we have written about implementing subscription billing the right way for teams who need that. This post is about the harder, increasingly common one: charging customers for what they actually use. Per API call, per gigabyte stored, per message sent, per seat plus overages. Usage-based and hybrid pricing can fit a product far better than a flat fee, but they come with a brutal requirement that flat plans mostly dodge. The numbers have to be right, every time, for every customer, or you are either undercharging and leaking revenue or overcharging and losing trust.

When usage-based beats a flat fee

Flat pricing is simple to build and simple to understand, and for a lot of products it is the right answer. Usage-based pricing earns its complexity when value and cost both scale with consumption. If a heavy customer costs you ten times more to serve than a light one, charging them both the same flat fee means the light users subsidise the heavy ones, and eventually that math turns against you.

The strongest fit is hybrid: a base subscription that covers a predictable amount, plus metered charges for usage beyond it. Seats plus overages. A platform fee plus per-transaction pricing. This gives you the recurring revenue and forecastability of a subscription while still capturing more from your biggest users. Pure metered pricing, where customers pay only for what they use, is powerful but scary for buyers, because they cannot predict their bill. Most mature SaaS platforms land on hybrid for exactly that reason: a floor for you, a ceiling of fairness for them.

The decision is a business one before it is an engineering one. Pick the model that matches how your product actually delivers value, then build the machinery to bill it accurately. Get that order wrong and you end up retrofitting metering onto a pricing model that never suited the product.

The hard part is accurate metering

Here is the thing nobody warns you about. The billing provider is not your hard problem. Stripe, and the metering tools layered on top of it, will happily aggregate usage records and produce an invoice. The hard problem is upstream: counting what your customers do correctly, in real time, at volume, without losing or double-counting a single event. That counting layer is your responsibility, and it is where the money quietly goes missing.

A usage event, an API call, a gigabyte stored, a job run, has to be captured the moment it happens, attributed to the right customer and the right meter, and recorded somewhere durable before it can be aggregated into a bill. Several things make this genuinely hard.

  • Volume. A busy product generates millions of billable events a day. You cannot write each one straight to your billing provider in the request path; you would add latency to every call and hammer their rate limits. You need a metering pipeline that buffers, batches, and aggregates before anything reaches the provider.
  • Idempotency. The same event can be recorded twice: a retried request, a redelivered message, a worker that crashed mid-flush and ran again. Every usage record needs a stable, unique key so the same action is never counted twice. This is the same discipline that makes webhook handlers safe, applied to your own pipeline.
  • Attribution. Usage has to be tied to the right customer and the right meter at the moment it happens, because account hierarchies, plan changes, and reassigned seats can all move the target. Get attribution wrong and you bill the wrong account, which is worse than billing the wrong amount.
  • Aggregation windows. You sum usage over a billing period, but periods have edges. An event that lands a second after midnight on renewal day belongs to the new period, not the old one. Off-by-one errors at the boundary are how invoices end up subtly, persistently wrong.

This is real backend infrastructure, not a billing config screen, which is why it usually sits with API and backend engineering rather than with whoever set up the checkout. It is one of the parts of SaaS product development that looks like a configuration task and turns out to be a system. Treat metering as a system you design, with the same care you would give any pipeline that has to be exactly right.

Syncing usage to the provider without drift

Once you are counting correctly, you have to get those numbers into the billing provider so it can issue an invoice. This sync is where two systems can quietly disagree, and disagreement here means money. Your database thinks the customer used 1.2 million units; the provider's records say 1.1 million; the invoice is wrong and nobody notices until the customer's finance team does.

A few practices keep the two in step:

  • One source of truth for raw usage. Keep your own durable record of every metered event before you push aggregates anywhere. The provider is the billing engine, not your system of record. If you need to recompute a bill, dispute a charge, or audit a number, you reconstruct it from your data, not theirs.
  • Idempotent pushes. When you report usage to the provider, use idempotency keys so a retried sync does not double-report. The same defensive habit that protects your pipeline protects the handoff.
  • Reconciliation as a routine job. Run a scheduled check that compares your aggregated usage against what the provider recorded for the period. Drift is not an exception to handle when a customer complains; it is a number you watch on a dashboard, so you catch a discrepancy before it ships on an invoice.

Proration, plan changes, and avoiding bill shock

Metered pricing collides with the same lifecycle events that complicate flat plans, only with sharper edges. When a customer upgrades mid-cycle, changes their included allowance, or adds a seat, you have to decide how usage already accrued is treated, and the answer has to be a deliberate policy, not whatever the code happens to do. Proration on the subscription part is the provider's job; proration of the usage allowance is yours to define.

Then there is bill shock, the single fastest way to lose a usage-based customer. Someone runs a heavy job, leaves a process looping, or onboards a big team, and the next invoice is ten times what they expected. Even if the charge is technically correct, the surprise erodes trust and triggers a chargeback or a cancellation. The fix is to make usage visible and predictable: a live usage meter in the product, alerts as customers approach a threshold, and optionally soft caps or spend limits they can set themselves. A customer who can see the meter running rarely disputes the bill. Transparency is not a nice-to-have here; it is part of the billing system.

If you are building usage-based pricing into a brand-new product, it is worth deciding early how much of this you need on day one. A simple usage model in an MVP can start with basic metering and add reconciliation, alerting, and soft caps as the customer base grows, as long as the counting layer is built honestly from the start. The expensive mistake is bolting metering on later onto a pipeline that was never designed to count anything precisely.

The takeaway

Usage-based and hybrid pricing can fit your product far better than a flat fee, but they raise the stakes on correctness. The billing provider is the easy part; the hard part is a metering pipeline that counts every event exactly once, attributes it correctly, aggregates it cleanly across period boundaries, and stays in sync with the provider through reconciliation. Add live usage visibility and sensible caps so customers are never ambushed by a bill. Do that and metered billing becomes a system you can trust, instead of a slow leak you discover at the worst possible time.

If you are weighing usage-based pricing or wrestling with a metering setup whose numbers do not add up, that is squarely the kind of work we do. Tell us how you want to charge and we will help you build billing that is right to the cent, every cycle. That is the good kind of lazy: getting the hard counting right once so you never have to chase a wrong invoice again.

Related service

SaaS Platforms

From first login to multi-tenant scale.

Learn more

Want this built right?

This is the work we do every day. Tell us what you are building and we will show you exactly how we would ship it.

hello@lazydevsagency.com