Volume billing: boleto issuance with tiered pricing
The business need
A fintech offers boleto issuance to its business clients. Pricing is volume-based: the more boletos a client issues per month, the lower the unit cost. The first 50 boletos each month are complimentary. Clients issuing over 1,000 boletos receive an additional 5% discount; above 3,000, the discount increases to 10%.Pricing structure
| Range | Unit price |
|---|---|
| 1–500 | R$ 1.20 |
| 501–2,000 | R$ 0.80 |
| 2,001+ | R$ 0.45 |
Package configuration
How the calculation works
At month-end, the orchestrator callsPOST /v1/billing/calculate with the billing period. The engine counts approved boleto transactions per account, subtracts the free quota, applies tiered pricing, and applies the matching discount.
Example result — a client that issued 1,800 boletos in March:
| Step | Detail | Amount |
|---|---|---|
| Total issued | 1,800 boletos | — |
| Free quota | 50 exempt | — |
| Billable | 1,750 boletos | — |
| Tier 1 | 500 × R$ 1.20 | R$ 600.00 |
| Tier 2 | 1,250 × R$ 0.80 | R$ 1,000.00 |
| Subtotal | — | R$ 1,600.00 |
| Discount | 5% (> 1,000 boletos) | −R$ 80.00 |
| Total | — | R$ 1,520.00 |
client-operating by R$ 1,520.00 and credits fees-boleto-revenue.
Maintenance billing: monthly account fee (PF)
The business need
A digital bank charges a fixed monthly maintenance fee for active personal (PF) accounts. The fee is R$ 9.90 per account. Inactive, closed, or suspended accounts are excluded automatically — no manual filtering required. Accounts are organized by segment in Midaz. The segmentseg_pf groups all personal accounts.
Package configuration
How the calculation works
The engine resolves all accounts in the PF segment, filters for active status, and generates a single N:1 transaction: each active account is debited R$ 9.90, and the full total goes tofees-maintenance-pf.
Example result — 12,000 active PF accounts:
| Detail | Value |
|---|---|
| Active accounts | 12,000 |
| Fee per account | R$ 9.90 |
| Transaction entries (source) | 12,000 debit entries |
| Transaction entries (destination) | 1 credit entry |
| Total revenue | R$ 118,800.00 |
Volume billing: fixed-price Pix with segment exemption
The business need
A fintech charges R$ 0.10 per Pix sent — flat rate, no tiers. Premium-tier customers are fully exempt from this fee. Instead of listing each premium account individually, the exemption is configured at the segment level.Package configuration
Segment exemption
To exempt premium accounts, configure the fee package (Motor 1) for thepix-send route with a segment reference in waivedAccounts:
How the calculation works
Example result — 5,000 Pix transactions from standard accounts:| Detail | Value |
|---|---|
| Total Pix sent | 5,000 |
| Unit price | R$ 0.10 |
| Total | R$ 500.00 |
Maintenance billing: PJ portfolios with different rates
The business need
A financial institution manages multiple business (PJ) account portfolios: PME (small and medium enterprises) and Corporate. Each portfolio has a different monthly maintenance fee. The institution wants to calculate both in a single billing run.Package configuration
PME portfolio — R$ 29.90/month:How the calculation works
A single call toPOST /v1/billing/calculate with "type": "maintenance" processes both packages. The response includes one result per package and a consolidated summary.
Example result — 500 PME accounts + 50 Corporate accounts:
| Portfolio | Active accounts | Fee | Total |
|---|---|---|---|
| PME | 500 | R$ 29.90 | R$ 14,950.00 |
| Corporate | 50 | R$ 89.90 | R$ 4,495.00 |
| Consolidated | 550 | — | R$ 19,445.00 |
fees-maintenance-pj account, keeping revenue consolidated. The orchestrator sends each transaction payload to Midaz independently.
Next steps
Create a billing package
API reference for creating volume and maintenance billing packages.
Calculate billing
Trigger billing calculations for a period and retrieve transaction payloads.
Billing calculations
Detailed mechanics of tiered pricing, free quotas, and maintenance billing.
Best practices
Operational guidance for billing packages in production.

