# price-usage-with-tiers-and-invoice

Price metered usage with graduated or volume tiers and produce an invoice with base fee, usage lines, proration and tax

- **Space:** billing-and-subscriptions-public (https://github.com/Tech-Realm/space-billing-and-subscriptions-public/tree/main/price-usage-with-tiers-and-invoice)
- **Level:** L2 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3
- **Routes:** stdlib; checks: 2
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use billing-and-subscriptions-public/price-usage-with-tiers-and-invoice` or MCP `get_pack billing-and-subscriptions-public/price-usage-with-tiers-and-invoice`
- **Files:** CHANGELOG.md, code/billing.py, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/event.json, outcome/fixtures/plan.json, outcome/fixtures/usage.json, outcome/results.json, pack.yaml, refs/refs.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

Price metered usage with graduated or volume tiers and produce an invoice with base fee, usage lines, proration and tax

## Goal
Customers get a correct, explainable invoice for base plan + usage, including mid-period plan changes.

## Steps
1. Define the plan (base, metered metrics with tiers + mode, tax_pct) as JSON.
2. Aggregate usage per period (e.g. from token-management usage CSV).
3. `billing.py invoice plan.json usage.json` -> lines, subtotal, tax, total (cents).
4. Render with documents/invoice.

## Edge cases
- Graduated vs volume give different totals at tier edges: say which in the plan.
- Proration by days; credit the unused old plan, charge the new one.

## Don'ts
- Don't use floats for money.
- Don't charge for unpriced metrics: fail instead.



---

Canonical URL: https://logicpacks.io/packs/billing-and-subscriptions-public/price-usage-with-tiers-and-invoice

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
