---
title: "Name the tier model of every metered price · Agent Wranglers"
url: https://agentwranglers.se/playbook/usage-billing/usage-on-invoices/tiered-or-volume
id: USG-30
level: Recommended
applies: payments
updated: 2026-10-27
build: a2a6bdfed830
tokens: 920
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Name the tier model of every metered price

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Usage on invoices](https://agentwranglers.se/playbook/usage-billing/usage-on-invoices.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: USG-30
- Level: Recommended
- Chapter: [Usage on invoices](https://agentwranglers.se/playbook/usage-billing/usage-on-invoices.md)
- Rule: Store with every tiered price whether it is graduated or volume. Graduated applies each tier's rate to the units inside it, and volume applies one rate to all units. Compute both in one tested function.
- Check: A unit test bills 1,500 units on the price above in each mode and gets 14,000 and 12,000 cents. A test bills a quantity exactly on a tier boundary and gets the documented result. Every tiered price in the catalogue has a mode.
- Applies when: The project takes payments.
- How: For a price of 10 cents for the first 1,000 units and 8 cents after, 1,500 units cost 140 euros graduated. The same price read as volume costs 120 euros. Payment providers support both, such as Stripe's graduated and volume tiers, so set the mode explicitly and show it on the pricing page. Write the tiers as data with an upper bound per tier and the last tier open, in the [versioned price catalogue](https://agentwranglers.se/playbook/pricing/plans-and-prices/price-catalogue.md). Bill the period total once, never per event, or a volume price never reaches its lower rate.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
export function tieredAmountMinor(quantity, tiers, mode) {
  if (mode === 'volume') {
    const tier = tiers.find(t => t.upTo === null || quantity <= t.upTo)
    return quantity * tier.unitMinor
  }
  let previous = 0
  return tiers.reduce((sum, tier) => {
    const units = Math.max(0, Math.min(quantity, tier.upTo ?? Infinity) - previous)
    previous = tier.upTo ?? previous
    return sum + units * tier.unitMinor
  }, 0)
}
```

### Python example

```python
def tiered_amount_minor(quantity, tiers, mode):
    if mode == "volume":
        tier = next(t for t in tiers if t.up_to is None or quantity <= t.up_to)
        return quantity * tier.unit_minor
    total, previous = 0, 0
    for tier in tiers:
        upper = quantity if tier.up_to is None else min(quantity, tier.up_to)
        total += max(0, upper - previous) * tier.unit_minor
        previous = tier.up_to or previous
    return total
```

## Related rules

- PRC-1 [Keep prices in a versioned catalogue](https://agentwranglers.se/playbook/pricing/plans-and-prices/price-catalogue.md) in Pricing, plans and entitlements

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/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/usage-on-invoices/tiered-or-volume">Agent Wranglers usage-based billing playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Credit back usage your own fault caused](https://agentwranglers.se/playbook/usage-billing/usage-on-invoices/usage-credit-notes.md)
- Next: [Bill early when unbilled usage passes a threshold](https://agentwranglers.se/playbook/usage-billing/usage-on-invoices/threshold-billing.md)
- [Usage on invoices](https://agentwranglers.se/playbook/usage-billing/usage-on-invoices.md)
