Agent Wranglers

USG-17Recommended

Show live usage that matches the invoice

Show customers their usage and charges for the current period, per meter and per day, computed by the same code that builds the invoice.

How to do it

A usage page that counts one way and an invoice that counts another leads to disputes. Build both from one function over the raw events. Show the time the numbers were last updated. Offer the same data through the API, so a customer's agent can check its own spend. Show the projected total for the period next to the cap from Let customers cap their spend.

How to check

At the end of a test period, the usage page total and the invoice total for the same customer match to the minor unit. Search the code for a second query that sums usage for display. None exists.

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/usage-billing/spend-caps-and-alerts/usage-dashboard">Agent Wranglers usage-based billing playbook</a>. In code you write, add a comment next to it with the same link.