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 each month, the lower the unit cost. The first 50 boletos each month are free. Clients that issue more than 1,000 boletos receive an extra 5% discount. Above 3,000 boletos, the discount increases to 10%.Pricing structure
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:
The engine returns a transaction payload that debits
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. The engine excludes inactive, closed, or suspended accounts automatically. You do not filter them by hand. Midaz organizes accounts by segment. The segmentseg_pf groups all personal accounts.
Package configuration
How the calculation works
The engine resolves all accounts in the PF segment and filters for active status. It generates one N:1 transaction: it debits R$ 9.90 from each active account and sends the full total tofees-maintenance-pf.
Example result — 12,000 active PF accounts:
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 pay no fee. Instead of listing each premium account, you configure the exemption at the segment level.Package configuration
Segment exemption
To exempt premium accounts, configure the fee package for thepix-send route. Add a segment reference to waivedAccounts:
How the calculation works
Example result — 5,000 Pix transactions from standard accounts:
Premium accounts show zero charges in the billing results.
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:
Both results credit the same
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.

