Why this matters
For product and operations teams, Transaction Routes give you auditable Pix flows without application-level enforcement. Every transaction carries a reference to the route it followed, so compliance reviews and incident investigations stay simple. For engineering teams, routes remove repetitive validation code. You configure the account and fee rules once. Midaz then enforces them at the ledger level on every Pix integration.
For a deeper look at how Transaction Routes and Operation Routes work, see Accounting Routes.
Prerequisites
Both scenarios assume a Midaz environment with the following structure already in place:
Values in Midaz are decimal amounts. For BRL,
150.00 means R$ 150.00.Scenario 1: Simple Pix transfer
Alice sends R$ 150.00 to Bob via Pix. The money moves from one checking account to another — no fees, no splits, just a clean peer-to-peer transfer.
The goal
- Debit Alice’s checking account by R$ 150.00
- Credit Bob’s checking account by R$ 150.00
- Validate that both accounts are of type
checkingbefore processing - Make this pattern reusable for every Pix transfer between checking accounts
Setting up the routes
1
Create the source Operation Route
This route defines the debit side of the transfer. The Save the returned
account_type rule accepts any account of type checking as a source. The route does not hardcode a specific sender.id — you need it when you build the Transaction Route.2
Create the destination Operation Route
This route defines the credit side. It uses the same rule type: any
checking account qualifies as a valid receiver.3
Create the Transaction Route
Group both Operation Routes into a single Transaction Route. This route represents “Pix Transfer” in your system.Replace the placeholder IDs with the actual Operation Route IDs from the previous steps.
Executing a Pix transfer
With the route in place, every Pix transfer references the Transaction Route ID in therouteId field. Midaz validates that the accounts match the route’s rules before it processes the transaction.
What happens under the hood
1
Midaz receives the transaction
The request carries the Transaction Route ID in the
routeId field. Midaz loads the route configuration.2
Source validation
For each
from entry, Midaz checks the account against the source Operation Route rules. Alice’s account is type checking, so it matches the account_type rule. Validation passes.3
Destination validation
For each
to entry, Midaz checks the account against the destination Operation Route rules. Bob’s account is type checking, so validation passes.4
Midaz processes the transaction
Both validations pass, so Midaz creates the transaction atomically. It debits
@alice_checking by R$ 150.00 and credits @bob_checking by R$ 150.00.Scenario 2: Pix transfer with fee collection
This flow matches Scenario 1, but now the bank charges a R$ 1.50 fee on each Pix transfer. The flow adds a third Operation Route for the fee destination, and Alice’s total debit rises to R$ 151.50.
What changes
You already have the source and destination Operation Routes from Scenario 1. You add one Operation Route for the fee and a new Transaction Route that groups all three.Setting up the fee route
1
Create the fee Operation Route
The previous routes use
account_type. This one uses the alias rule type instead. It targets one specific account — @revenue_pix_fees — and no other account qualifies.2
Create the Transaction Route with fee
This route groups the original source and destination routes with the new fee route. It is a separate Transaction Route from the simple transfer, so your system can offer both variants.
Executing a Pix transfer with fee
Alice sends R$ 150.00 to Bob. The bank collects R$ 1.50. Alice’s total debit is R$ 151.50.What this unlocks
- Transparent fee collection — the fee is a first-class ledger entry, not hidden metadata. Finance and compliance teams see exactly where the R$ 1.50 went.
- Reusable building blocks — the simple and fee variants share the source and destination Operation Routes. You add only what changes.
- Route-level control — your system can offer both “Pix Transfer” and “Pix Transfer with Fee” as distinct products, each backed by its own Transaction Route.
- Easy evolution — to add a percentage-based fee or a split across revenue accounts, create new Operation Routes and compose a new Transaction Route. Existing flows stay untouched.
Understanding rule types
The two rule types serve different purposes. The right choice depends on whether the account in a route is dynamic or fixed.
What you need to get started
You must enable Transaction Route validation for each ledger. See Working with Accounting Routes for the configuration steps.
Next steps
Accounting Routes
Understand how Operation Routes and Transaction Routes work at a deeper level.
Transactions
Learn about Midaz’s double-entry transaction model and N:N capabilities.
Pix with automated fees
Combine the Pix Plugin with the Fees Engine for automated fee management.
Pix Switch
Explore the full Pix Plugin architecture and connection models.

