# Usage-Based Billing: Metering and Rating for SaaS and Digital Services

> How to build usage-based billing: choosing units, separating metering, rating, and billing, deduplicating events, reconciliation, customer transparency, margin, finance integration, and transition.

Source: https://www.agsora.tech/en/blog/penagihan-berbasis-pemakaian-metering-dan-rating-untuk-produk-saas-dan-jasa-digital
Category: Technology · Published: 2026-11-26 · Updated: 2026-12-02 · By PT Agsora Teknologi Indonesia

Per-user pricing is easy to understand, but it does not always reflect value or cost. AI features consume tokens, messaging services are paid per message, and logistics platforms grow with shipment volume. More providers are therefore considering usage-based billing or hybrid models. The change looks like a price list matter, yet in practice it is a data project: you have to record usage accurately, calculate it with clear rules, and prove it when a customer asks. This article covers how to build it.

*Customers accept usage-based bills more readily when they can see the numbers before the invoice is issued.*

## When the model makes sense

Usage-based billing fits when there is a unit customers understand, that relates to the value they receive, and that can be measured without ambiguity. Examples include documents processed, transactions, messages delivered, storage, or compute hours.

Watch for the opposite signals:

- The unit is technical and meaningless to the buyer, such as a count of internal calls.
- Usage is so hard to forecast that the customer's finance team will not approve it.
- Customers are pushed to use the product less, although that usage is what keeps them.
- Your system cannot yet record usage reliably.

A hybrid model is often the middle path: a base fee that includes an allowance, then a rate for overage. Your revenue is steadier and the customer gets a limit they can plan around. General pricing principles can be compared with [subscription business models and recurring billing](https://www.agsora.tech/en/blog/model-bisnis-langganan-dan-tagihan-berulang).

## Three layers to keep separate

### Metering

Metering records facts: who used what, how much, and when. This layer knows nothing about price. When prices change, usage records stay the same.

### Rating

Rating applies price to those facts: free allowances, tiers, negotiated contract prices, rounding, and currency. Rating rules need versions, so an old bill can be recalculated exactly as it was issued.

### Billing

Billing assembles invoices, tax, credits, and delivery, then records payment. It should receive locked rating results rather than recalculate from raw data.

This separation stops a promotion change from corrupting records and makes audits easier.

## Designing the usage event

Each usage event should contain at least:

- A unique event identifier.
- The customer or tenant identifier.
- The meter type.
- A quantity and its unit.
- The time it happened and the time it was received.
- The source, such as the sending service or device.

The unique identifier is your main protection. Network drops and resends will happen, so the receiver must recognise duplicates and count them once. Never generate a new identifier on retry.

Also decide your late event policy. A device that was offline may send data after the period has closed. You can add it to the next bill, allow a grace period before closing, or issue an adjustment. Write the policy into your terms of service. Reliable delivery architecture is discussed in [event-driven design and message queues](https://www.agsora.tech/en/blog/arsitektur-event-driven-dan-antrean-pesan-untuk-aplikasi-bisnis).

## Accuracy and reconciliation

Customer trust collapses over a single bill that cannot be explained. Build routine checks:

- Compare event counts with the logs of the services that produced them.
- Watch for sharp rises or drops per customer before billing.
- Make sure every event is tied to a valid customer.
- Keep raw data unmodified and record corrections as new entries.
- Separate test environments so they are never billed.

A simple anomaly alert often catches an error such as an endlessly looping process faster than a customer complaint would.

## Transparency for customers

Provide a usage page that refreshes regularly and shows the time of the last update. Display allowance consumed, a projected bill clearly labelled as an estimate, a breakdown by project or branch, and data export. Send notifications at thresholds the customer chooses.

Offer safeguards: a spending cap, a choice to stop or continue service when the allowance runs out, and approval for raising limits. Explain what each choice means. Suddenly cutting off a critical service can hurt more than a larger bill. Portals of this kind are covered in [B2B customer portals](https://www.agsora.tech/en/blog/portal-pelanggan-dan-pemasok-b2b).

## Protecting margin

If your own costs are also usage based, calculate margin per customer and per meter. Record supplier cost, such as AI model tokens or messaging fees, next to revenue. Some customers can lose you money even while total revenue rises. For AI features, the techniques in [controlling token and inference costs](https://www.agsora.tech/en/blog/mengendalikan-biaya-ai-token-dan-inferensi-untuk-aplikasi-bisnis) and [cloud cost control](https://www.agsora.tech/en/blog/mengendalikan-biaya-cloud-untuk-bisnis) are highly relevant.

Avoid promising a fixed price for components whose cost is set by someone else unless the contract allows adjustment.

## Integration with finance

Rating results need to reach the ERP or accounting system with a reference that traces back to usage detail. Decide how to treat prepaid credits, revenue earned but not yet billed, credit notes, tax, and exchange rates. Revenue recognition follows the accounting standards that apply to you, so involve an accountant at design time, not after the first invoice.

A practical point: a bill that changes every month is more likely to be held up in the customer's approval process. Provide detail that can be attached to a purchase order, and agree a tolerance for differences.

## Disputes and corrections

Write down the dispute procedure: the time limit for raising one, the evidence compared, who decides, and the form of the correction. A correction should be a recorded credit or adjustment, not a deleted event. If the fault lies in your system and affects many customers, recalculate all of them, not only those who complain.

## Example: a document processing service

A provider processes invoices for business customers. The base plan includes a set number of pages per month, and extra pages are charged individually. They decide that pages failing because of a system error are not billed, while re-uploads by the customer are billed and explained in the interface. Each page has a unique identifier based on the upload and page number. Customers are warned as the allowance runs low. Product decisions like these must be made before code is written, because they determine what a usage event contains.

## Rating rules that are often forgotten

Tiered pricing can be calculated in two ways with very different results. With graduated rates, each band is charged at its own price. With volume rates, all usage is charged at the price of the highest tier reached. Put a worked example in the contract so there is no double reading.

Also decide the following before writing code:

- The time zone that defines period boundaries.
- Whether unused allowance expires or rolls over.
- Proration when a customer changes plan mid-period.
- Where rounding happens: per event, per line, or per invoice.
- Minimum charges and caps, if any.
- The order in which promotional and paid credits are consumed.

Turn each decision into an automated test case with figures approved by finance. When rules change, old cases still apply to old periods.

## Closing a period in order

Period close needs a clear sequence. Wait out the late event grace period, run completeness checks, calculate draft bills, review anomalies, lock the results, and only then issue invoices. Show customers whose change exceeds a threshold to a human reviewer.

The process must be safe to rerun. If it fails midway, repeating it must not create duplicate invoices. Record the pricing rule version used on every line. The schedule should line up with your [monthly close](https://www.agsora.tech/en/blog/tutup-buku-bulanan-lebih-cepat-dengan-erp) so current period revenue is not left behind.

## Build it or buy a service

A usage billing service can speed up the start, especially for aggregation, tiers, and invoices. Building your own gives full control but adds maintenance to a part that must not be wrong. Judge by event volume, complexity of custom contracts, local tax needs, ERP integration, service fees as you scale, and how easily data can be moved.

Whatever you choose, keep a copy of raw events somewhere you control. That data is the evidence for your bills and your way out if you later change provider.

## Explaining the bill to customers

A usage invoice must be readable by a finance person who has never opened your product. Show meter names in business language, quantity, allowance deducted, applicable rate, and a line total, then link to daily detail. If there is a credit or adjustment, write the reason. Train support to answer three questions that will certainly come: why did it rise, who used it, and how can it be limited next month.

## Testing metering before trusting it

Billing deserves stricter testing than ordinary features because its errors touch customer money directly. Prepare deliberately disruptive scenarios: the same event sent many times, events arriving out of order, a device with the wrong clock, a connection dropping mid-send, a sudden volume spike, and a customer cancelling mid-period.

Define the correct outcome for each scenario before running it. Recalculate sample bills independently, for example with a worksheet built by the finance team, and match them to the smallest unit. Run the same checks whenever pricing rules or an event-producing service changes. Include load testing too, since queues backing up at peak can leave the customer dashboard far behind reality. See [load testing before peak season](https://www.agsora.tech/en/blog/load-testing-uji-beban-sebelum-promo-besar-dan-musim-puncak).

## The role of sales and contracts

A usage model changes the sales conversation. The team needs to estimate bills from a customer scenario, explain allowances and overage, and be honest about uncertainty. Provide a simple calculator with visible assumptions. Also review how commission is calculated: on committed value, actual usage, or both. The contract should define each meter, the data source considered authoritative, how price changes are announced, and the customer's right to usage detail. A vague definition today becomes a dispute next year.

## Monitoring after go-live

Once billing is live, watch a few operational measures: the gap between events sent and received, queue age, corrections per period, the share of invoices disputed, and time to close. A rise in any of them is an early signal, long before customers lose trust. Name one owner who reviews these figures at every period end and records the follow-up.

## A transition plan

Run metering in shadow mode for several periods: record and calculate without charging. Compare with the old price, find customers whose bills would jump, and prepare a transition period or plan options. Give notice as your contracts require. Once accuracy is proven and support staff can explain every bill line, switch billing on in stages.

Start with one meter. One accurate unit that customers understand is far more useful than five meters argued over every month.

Usage quotas also need enforcing through [rate limiting and API quotas](https://www.agsora.tech/en/blog/rate-limiting-dan-kuota-api-melindungi-aplikasi-bisnis-dari-lonjakan-dan-penyalahgunaan).

**Planning to bill by usage?** Agsora helps design auditable metering, rating rules, usage portals, and billing integration. [Free consultation](https://www.agsora.tech/en/services/custom-software)
