Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt

Use this file to discover all available pages before exploring further.

A Fee Package groups fee rules and defines when they apply to Transactions.

Before you start


  • The Fees Engine plugin must be enabled in Midaz module settings.
  • You need an existing Ledger and at least one Account that can receive fee amounts.
  • If the package should apply only to a specific route or segment, create those records first.

Create the Fee Package


1
Go to the Fee Packages page and click the New Package button.
2
The New Fee Package form will open with multiple sections to configure.
Check the field guide for more information about the fields in the form.
1
Fill in the Basic Information section
2
Configure the Amount Range section
Transactions outside this range will not have fees applied from this package.
3
Click the Next button.
4
Select one of the options in the Add Fee section:
  • Flat Fee - Fixed amount regardless of transaction value.
  • Percentage - Percentage of the transaction amount.
  • Max Between Types - Higher value between flat and percentage.
5
Add Fee information.
6
(Optional) You can add another fee rule if needed. To do so, select a new fee type and fill the information.
7
Click the Next button.
8
(Optional) Configure Account Waivers section:
  • Add account aliases that should be exempt from fees in this package
  • Click Add to add each waived account
9
Click the Next button.
10
Review the information and confirm that everything is correct.
11
Click the Create Package button.
If successful, you’ll see a confirmation message and be redirected to the Fee Packages list.

Field guide


Basic Information

FieldDescriptionExample
Fee Package NameRequired package name. Use a name that describes the charge model.Standard Transfer Fee
DescriptionAn explanation of when and why the package applies.Fixed fee for standard transfers
Transaction RouteOptional route filter for the package.Pix Transfer Route
Ledger IDThe unique identifier of the Ledger where this package applies.Brazil Payments Ledger
Segment IDOptional segment filter for targeted fees.Retail Customers
Minimum AmountLowest transaction amount eligible for the package.10.00
Maximum AmountHighest transaction amount eligible for the package.500.00

Fee Rules

Every fee inside a package has a Priority (1 = applied first). The fee with priority 1 must use Original Amount as Reference Amount.

Flat Fee

A fixed amount applied to the Transaction regardless of its value.
FieldDescriptionExample
AmountThe fixed amount charged for this fee. Must be a positive number.5.00
Fee NameUnique identifier for this fee, used as the JSON object key. Must start with a letter or underscore and contain only letters, numbers, or _.taxaAdm
Reference AmountBase used by the calculation: Original Amount (transaction value as sent) or After Fees Amount (value after previous fees in the package).Original Amount
Credit Account IDAlias of the account that receives the fee amount.@fees_transfers
Route FromOptional. Name or UUID of the source route for this fee operation.payments_in
Route ToOptional. Name or UUID of the destination route for this fee operation.fees_revenue
Deductible from transaction?When enabled, the fee is deducted from the transaction amount (recipient pays); when disabled, the fee is added on top (sender pays).Off
When Deductible from transaction? is enabled, Reference Amount is forced to Original Amount (the After Fees Amount option is disabled in the form).

Percentage Fee

A percentage of the Transaction amount.
FieldDescriptionExample
PercentagePercentage rate applied to the reference amount. Must be greater than 0 and less than or equal to 100.2.5
Fee NameUnique identifier for this fee, used as the JSON object key. Must start with a letter or underscore and contain only letters, numbers, or _.processingFee
Reference AmountOriginal Amount to charge on the transaction value as sent, or After Fees Amount to charge on the value after previous fees in the package.Original Amount
Credit Account IDAlias of the account that receives the fee amount.@fees_revenue
Route FromOptional. Name or UUID of the source route for this fee operation.payments_in
Route ToOptional. Name or UUID of the destination route for this fee operation.fees_revenue
Deductible from transaction?Enable so the fee is deducted from the transaction amount; disable to add the fee on top of the transaction.Disabled

Max Between Types

Calculates a flat amount and a percentage, then applies the highest result. Both calculations are required.
FieldDescriptionExample
Flat Fee (Calculations)First calculation row. Fixed amount candidate. Must be a positive number.1.00
Percentage Fee (Calculations)Second calculation row. Percentage candidate; must be greater than 0 and less than or equal to 100.2.0
Fee NameUnique identifier for this fee, used as the JSON object key. Must start with a letter or underscore and contain only letters, numbers, or _.guaranteeFee
Reference AmountBase used to calculate the percentage candidate before the comparison.Original Amount
Credit AccountAlias of the account that receives the resulting (highest) fee amount.@fees_guarantee
Route FromOptional. Name or UUID of the source route for this fee operation.payments_in
Route ToOptional. Name or UUID of the destination route for this fee operation.fees_revenue
Deductible from transaction?When enabled, the higher of the two results is deducted from the transaction amount; when disabled, it is added on top.Disabled
The Max Between Types form always requires exactly two calculations: one of type Flat Fee and one of type Percentage Fee. The Console computes both and applies the highest.

Important notes


Fee priority ordering

When a package contains multiple fees, they are applied in priority order (lowest number first). This matters when using After Fees Amount as a reference, since earlier fees affect the calculation base for later fees. Example:
  • Fee A (Priority 1): 1% on original amount
  • Fee B (Priority 2): 0.5% on after fees amount
On a $100 transaction:
  • Fee A = $1.00 (1% of $100)
  • Fee B = $0.495 (0.5% of $99)

Amount range considerations

  • Ranges should not overlap between packages for the same transaction route
  • Use 0.01 as minimum for packages that should apply to all transactions
  • Use a high maximum (e.g., 999999999.99) for no upper limit
  • Transactions exactly at min or max values are included in the range

Waived accounts behavior

  • Waived accounts bypass all fees in the package, not just specific fees
  • Use account aliases (not IDs) when adding waived accounts
  • Waivers apply when the waived account is the source of the transaction

What to do next


After creating the Fee Package, run a test calculation in Running a Fee Estimation before using it with live Transactions.