Skip to content

What is usage-based billing? A practical guide

Usage-based billing charges customers for what they actually use. Learn the pricing models, the hard parts, and whether to build it or buy it.

Payrudder team10 min read

Usage-based billing (also called metered billing) means you charge each customer for how much of your product they actually used in a billing period: API calls, AI tokens, gigabytes stored, minutes processed. Instead of one fixed price per seat or per month, the invoice is computed from usage records that your application sends as the customer works.

It sounds like multiplication. In practice it is a small data pipeline with money at the end of it, and most of the work is in making sure every unit is counted exactly once, priced with the right rate, and lands on the right invoice. This guide covers the pricing models, the parts that are harder than they look, and how to decide between building it, buying it, or running it yourself.

How usage-based billing works

Every usage-based billing system has the same four steps, whether it is a spreadsheet or a dedicated platform:

  1. Record usage. Your backend sends an event each time something billable happens: “customer 42 used 1,500 tokens”, “customer 7 made one API call”.
  2. Aggregate per period. Events are rolled up per customer, per meter and per billing period. A meter defines what is measured and how: a sum of a quantity, a count of events, the maximum value seen, and so on.
  3. Rate. The aggregated quantity goes through the customer’s price: a unit price, tiers, packages, plus any fixed fee.
  4. Invoice and collect. At period close, the rated lines become an invoice, which is charged, paid or chased.

The first two steps are where usage billing differs from subscription billing. A subscription invoice can be computed from the plan alone. A usage invoice depends on millions of small facts that arrive over the network, sometimes twice, sometimes late.

Usage-based pricing models

“Usage-based” covers several pricing shapes. Most products use one of these, or a combination:

Model How the charge is computed Example
Per unit quantity × unit price $0.01 per API call
Tiered (graduated) each tier’s units are priced at that tier’s rate first 10,000 calls free, the rest at $0.002
Tiered (volume) all units are priced at the rate of the tier the total reaches 50,000 calls, so every call at the 50k rate
Package price per block of N units, partial blocks rounded up $5 per 1,000 emails
Flat fee + usage a fixed fee per period plus metered lines $49 a month, plus $0.002 per call above the included amount
Prepaid credits the customer buys credits up front, usage spends them a pack of 10,000 credits for $20

A few notes from practice:

  • Graduated tiers are easier to explain than volume tiers, because crossing a threshold never makes earlier units cheaper or more expensive. Volume tiers create a cliff at each boundary that some customers will notice.
  • Flat fee + usage is the most common hybrid. The fee covers your fixed costs and gives revenue predictability; the usage part scales with value. A free allowance is just a first tier priced at zero.
  • Prepaid credits move risk to before the work. The customer pays first and you stop when the balance runs out. This is popular in AI products where a single heavy user can cost real money in an afternoon.

What is hard about usage-based billing

The pricing table is the easy part. The problems show up when real traffic hits the pipeline.

Duplicate events

Networks retry. Your client times out, sends the same event again, and the first one had already arrived. Without protection, the customer pays twice. The standard fix is an idempotency key on every event: a unique id the sender generates, so the receiver can recognise a retry and drop it. This has to hold across crashes and restarts, not just within one process, which means storing the keys durably and checking them in the same transaction that accepts the event.

Late events

Events don’t always arrive in the period they belong to. A mobile client syncs after a flight, a batch job backfills yesterday’s logs, a queue was down for an hour on the last day of the month. You need a rule for an event that belongs to October but arrives after October’s invoice was issued. The options are to hold every invoice open for a while (customers wait), to reopen and change sent invoices (accounting hates this), or to bill the late usage as an adjustment on the next invoice, labelled with the period it belongs to.

Price changes

Prices change: you launch a new plan, you raise a rate, a model provider changes what it charges you. Two things must stay true. Old periods must still be explainable with the price that applied at the time, which means prices need versions rather than being edited in place. And when you do need to re-price a period that is already closed (a pricing mistake, a negotiated discount backdated to the start of the month), you want to bill only the difference, not re-issue everything.

Period close

Closing a period is a race. If you compute totals at 00:00:01 on the 1st, events stamped 23:59:59 may still be in flight in a queue. A correct close waits until everything that arrived on time has been aggregated, then freezes the totals. Doing that without stopping ingestion, for thousands of customers at once, is real distributed-systems work.

Money arithmetic

Floating-point numbers cannot represent most decimal amounts exactly. A per-token price of $0.000002 multiplied over millions of events will drift if it is a float. Quantities and prices should be exact decimals, and rounding should happen once, at a defined place on the invoice line.

Build vs buy

There are two realistic routes, and buying splits in two by how the fee works. None is right for everyone.

Build it yourself

You control everything and pay no platform fee. You also own every problem in the previous section. A first version (an events table and a monthly cron job) takes days; making it correct under retries, late data, price versions and failures takes much longer, and the bugs are found by customers reading their invoices. Building makes sense if billing is your product’s core differentiator or your pricing is unusual enough that no tool fits.

Buy a platform that takes a percentage

Most hosted platforms handle metering and invoicing for you and price as a percentage of what you bill. At the time of writing:

  • Stripe Billing lists pay-as-you-go pricing of 0.7% of billing volume.
  • Orb says in its pricing FAQ that a credit works out to 0.60% of billing volume, plus event ingestion and other metered dimensions.
  • Paddle is a merchant of record and lists 5% + 50¢ per transaction, which covers more than billing.

A percentage fee is fine when you are small and grows with your revenue rather than your usage. At $50,000 a month of billing volume, 0.7% is $350 a month. Check whether the fee is charged on revenue or on system usage, because for usage-heavy, low-margin products the difference adds up.

Buy a service with a fixed plan

Some services charge a fixed monthly plan plus overage instead of a share of what you bill. Payrudder is one: plans are priced on monthly collections and metered events, from a free tier up, and the fee does not move when you raise your prices. The trade-off is a plan limit instead of a percentage, so check the limits against your event volume, and remember that the card processor’s own commission is still separate.

A quick way to decide:

  • Low volume, simple pricing, want zero ops: buy.
  • High event volume or thin margins, or several apps sharing one billing layer: a fixed-plan service, so the fee does not scale with revenue.
  • Billing logic is your product: build, and budget for the correctness work.

How Payrudder handles usage-based billing

Payrudder is a usage metering and subscription billing platform written in Go. NAFRU built it as the shared billing layer of its own apps. Here is how it maps to the problems above, as built today:

  • Meters aggregate with SUM, COUNT, MAX, UNIQUE (distinct values of a property) or LAST. Quantities are exact decimals (up to six decimal places), and money is never a float.
  • Pricing models: per unit, graduated tiers (each tier can also carry a flat fee), packages (rounded up to whole packages), and a fixed base fee on the plan. Volume (all-units) tiers are not a built-in model. Credit packs exist too: customers buy them through a payment link or the customer portal, and your backend spends credits with an API call that refuses when the balance does not cover it.
  • Duplicates: every event carries an idempotency key. A retry is answered duplicate and is never counted twice; the same key with a different payload is rejected.
  • Late events: lateness is decided by when the event arrived, against a grace period you choose (0 to 7 days). A late event is billed as an adjustment line on the next invoice, priced with the original period’s plan version so tiers are respected.
  • Price changes: plan versions are immutable once published. Re-rating a closed period under a new version bills only the price difference, as a correction invoice.
  • Period close waits for a watermark (everything that arrived on time is aggregated) before rating. In Payrudder’s published benchmark, run on an Apple M4 laptop with a 2.9 GiB Docker VM, closing a month for 10,000 customers × 5 meters took 289 s, and ingest sustained 5,000 events/s at p99 32 ms. Two targets were missed on that machine, and the report says which.

Around the metering there are subscriptions, coupons, credit notes, hosted invoice pages and signed webhooks. Payments go through Paddle, iyzico or bank transfer. To be clear about status: the Paddle and iyzico adapters are written from the providers’ documentation and tested against fixtures, but they have not been run against the providers’ sandboxes yet.

Payrudder Cloud is in early access. The details are on the usage metering page, and if you bill per request, the API usage billing use case walks through a concrete setup.

Getting started

Usage-based billing goes wrong in the boring places: a retried request, an event that shows up two days late, a price edited in place. Pick a tool, or a design of your own, that has an answer for each of those before your first invoice goes out. Payrudder Cloud is in early access, priced by system usage rather than a share of your revenue. The plans are on the pricing page.

Still adding up usage in a spreadsheet at month end?

Payrudder meters usage, issues the invoice and collects through iyzico, Paddle or bank transfer.

Keep reading