Skip to main content
Offering Pix is just the beginning. What turns a payment rail into a financial product is how you manage fees, distribute revenue, and maintain a clear audit trail for every transaction. By combining Midaz (the ledger), the Pix Plugin (Pix connectivity), and the Fees Engine (automated fee logic), institutions can launch Pix operations with built-in fee management — no custom middleware, no manual reconciliation, and no gaps in your accounting. This page walks through two real-world scenarios where this combination delivers immediate value.

Why this combination matters


Each component solves a specific layer of the problem:
ComponentRole
MidazCore ledger — records every debit, credit, and fee movement with double-entry precision
Pix PluginPix connectivity — handles transaction orchestration, DICT, QR Codes, and settlement through your chosen participation model
Fees EngineFee automation — calculates, splits, and routes fees based on configurable packages
When connected, these three components create a closed-loop system: Pix transactions arrive, fees are calculated automatically, and the ledger records every movement — principal, net, and fee amounts — in a single, auditable operation.

Choosing your Pix participation model


The Pix Plugin supports both participation models defined by BACEN. The fee integration and ledger flow described on this page apply equally to both — the difference lies in how your institution connects to BACEN’s infrastructure.
Indirect PixDirect Pix
How it connectsThrough a Direct Participant (e.g., BTG)Directly to SPI/DICT via a certified PSTI (e.g., JD)
Best forFintechs, payment institutions seeking fast onboardingBanks and regulated FIs with full operational autonomy
Regulatory burdenShared with the Direct ParticipantFully owned by the institution
Time to marketWeeksLonger, but with maximum control
Fee Engine integrationNativeNative
Midaz integrationMandatoryMandatory
Indirect Pix via BTG is production-ready and the fastest path to offering Pix with enterprise-grade compliance. Your institution connects through BTG’s infrastructure, eliminating the need for ISPB certification or direct BACEN connectivity.Direct Pix via JD is currently under active development. You can already explore its APIs and capabilities in the API reference.
For a detailed comparison, see Direct vs. Indirect Pix Plugin.

Scenario 1: Fintech launching Pix with automated fees


A fintech is preparing to offer Pix to its customers. It needs to charge a flat fee on every incoming Pix (cash-in) to cover operational costs and generate revenue — without adding complexity to the customer experience. Whether the fintech operates as an indirect participant (via BTG) or as a direct participant (via JD), the fee logic and ledger structure remain the same.

The business goal

  • Offer instant Pix payments to end customers
  • Charge a transparent, configurable fee on incoming transfers
  • Record every fee in the ledger for compliance and financial reporting
  • Launch quickly, without building custom fee logic or reconciliation pipelines

Setting up with Midaz

The fintech starts by structuring its Midaz environment:
1

Create the Organization

Register the fintech as an Organization in Midaz. This is the top-level entity that owns all ledgers, accounts, and transactions.
2

Set up the Ledger

Create a Ledger to track all customer transactions and fee movements. This ledger is shared by the Pix Plugin and the Fees Engine.
3

Define the Asset

Register BRL as the operating asset. All Pix transactions and fee calculations use this asset.
4

Create customer accounts

Each customer gets an account under the ledger. These accounts receive Pix credits and are subject to fee rules.
5

Create fee destination accounts

Set up internal accounts to receive fee credits — for example, a “Pix Fee Revenue” account. These are referenced in the Fees Engine package configuration.
6

Organize with Segments

Use Segments to group customers by tier (e.g., Standard, Premium). This allows you to apply different fee packages to different groups.

Configuring the Fees Engine

With the ledger structure in place, the fintech configures a fee package:
  • Fee type: Flat fee of R$ 1.50 per incoming Pix
  • Scope: Applied to all cash-in transactions on the main ledger
  • Routing: Fee credits are routed to the “Pix Fee Revenue” internal account
  • Exemptions: Premium-tier accounts are added to the waived accounts list
The Fees Engine supports multiple calculation methods — flat fees, percentage-based fees, or a “max between” rule that applies whichever is greater. For this scenario, a flat fee keeps pricing predictable for customers.
Fee packages are configured once and applied automatically. When a Pix transaction matches the package criteria (ledger, segment, amount range), the Fees Engine calculates and routes the fee without any manual intervention.

How a transaction flows

When a customer receives a Pix transfer, here’s what happens behind the scenes:
1

Pix arrives

The sending institution initiates a Pix. Your connectivity provider (BTG for indirect, JD for direct) receives the transaction and notifies the Pix Plugin.
2

Transaction is validated

The plugin validates the recipient: checks the account exists, is active, and can receive funds. CRM data and Pix key validity are also verified.
3

Settlement begins

Once the transaction is confirmed, the settlement process starts. The plugin fetches the destination account details from Midaz.
4

Fees are calculated automatically

The Fees Engine evaluates the transaction against available fee packages. It finds a matching package and calculates the R$ 1.50 flat fee.
5

Ledger records the full picture

Midaz records the transaction with the fee distribution in a single operation:
  • The customer’s account is credited with the net amount (gross minus fee).
  • The fee destination account is credited with R$ 1.50.
  • Every movement is traceable, with double-entry precision.
6

Transaction is complete

The customer sees the Pix credit in their account. The fee is recorded transparently, available for reporting and reconciliation.

What this unlocks

  • No custom fee logic — the Fees Engine handles calculation, routing, and exemptions.
  • Accurate ledger — every fee is a ledger entry, not just metadata. Auditors see the same numbers your finance team sees.
  • Customer segmentation — Premium customers can be exempted automatically using waived accounts.
  • Fee flexibility — change fee values, add percentage-based fees, or introduce amount-based thresholds without changing your transaction pipeline.

Scenario 2: Marketplace with Pix and proportional fees


A B2B marketplace connects buyers and sellers. Buyers pay via Pix, and the marketplace charges a service fee on each transaction before distributing the remaining amount to sellers.

The business goal

  • Accept Pix payments from buyers
  • Charge a percentage-based service fee on each payment
  • Distribute the net amount proportionally across multiple sellers when a single payment covers goods from different sellers
  • Maintain a clear audit trail for every split and fee

Setting up with Midaz

The marketplace structures its Midaz environment to reflect the multi-party nature of its operations:
1

Create the Organization

Register the marketplace as an Organization in Midaz.
2

Set up the Ledger

Create a single Ledger to manage all payment flows — buyer payments, seller credits, and marketplace fees.
3

Define the Asset

Register BRL as the operating asset.
4

Create seller accounts

Each seller gets an account in the ledger. When a buyer pays via Pix, the net amount is distributed across the relevant seller accounts.
5

Create the marketplace fee account

An internal account (e.g., “Marketplace Service Fee”) receives the fee portion of every transaction.
6

Use Segments for seller tiers

Sellers can be grouped into segments (e.g., Standard Sellers, Partner Sellers) to apply different fee rates per group.

Configuring the Fees Engine

The marketplace configures a fee package with proportional distribution:
  • Fee type: 3% of the transaction value
  • Scope: Applied to all incoming Pix payments on the marketplace ledger
  • Distribution: Fees are split proportionally across source accounts when multiple sellers participate in a single transaction
  • Routing: Fee credits go to the “Marketplace Service Fee” account
  • Deductible: The fee is deducted from the amount received by sellers (isDeductibleFrom: true), so the buyer always sends the full amount

How a transaction flows

A buyer purchases R$ 1,000 worth of goods from three sellers:
SellerShareGross amount
Seller A50%R$ 500.00
Seller B30%R$ 300.00
Seller C20%R$ 200.00
1

Buyer sends Pix

The buyer scans a QR Code or uses a Pix key to send R$ 1,000 to the marketplace.
2

Pix arrives at the Plugin

The connectivity provider processes the transaction and notifies the Pix Plugin.
3

Fees are calculated with proportional split

The Fees Engine calculates a 3% fee (R$ 30.00) and distributes it proportionally:
  • Seller A: R15.00fee(R 15.00 fee (R 485.00 net)
  • Seller B: R9.00fee(R 9.00 fee (R 291.00 net)
  • Seller C: R6.00fee(R 6.00 fee (R 194.00 net)
4

Ledger records every movement

Midaz creates the transaction with full distribution:
  • Seller A’s account: credited R$ 485.00
  • Seller B’s account: credited R$ 291.00
  • Seller C’s account: credited R$ 194.00
  • Marketplace fee account: credited R$ 30.00
  • Total: R$ 1,000.00 — fully balanced
5

Sellers and marketplace are settled

Each seller sees their net credit. The marketplace sees the fee revenue. Every number ties back to a ledger entry.

What this unlocks

  • Automated revenue split — the Fees Engine handles proportional distribution across any number of accounts.
  • Transparent pricing for sellers — each seller knows exactly what fee was charged and why.
  • Balanced ledger — gross amount in equals the sum of all credits out. No rounding gaps, no manual adjustments.
  • Configurable rates — change the fee percentage, add flat minimums, or exempt specific partners — all through fee package configuration.

What you need to get started


To run this setup, your institution needs:
RequirementDetails
Midaz (v3.x.x+)Core ledger for account management and transaction recording
Pix PluginPix connectivity — choose Indirect (via BTG) or Direct (via JD) based on your participation model
Fees EngineAutomated fee calculation and routing
CRM PluginCustomer and account metadata used during Pix validation
InfrastructureSelf-managed cloud (BYOC) or on-premise environment
Connectivity contractAgreement with BTG (indirect) or JD/PSTI (direct) depending on your model
The Pix Plugin and the Fees Engine require a valid Lerian license. For license details, see the License documentation.

Simulating before going live


Before processing real transactions, use the Fees Engine’s simulation capability to validate your fee configuration. Simulations let you:
  • Preview exactly how fees will be calculated for a given transaction amount
  • Verify that exemptions work as expected
  • Confirm proportional splits produce the correct distribution
  • Test edge cases like boundary amounts and waived accounts
This is especially useful during onboarding, when you’re finalizing fee structures with business stakeholders before launch.
Use the Simulate Transaction Fees endpoint to test specific fee packages without writing anything to the ledger.

Next steps