Skip to main content
Fee handling in Matcher is split across two entities that work together:
  • A fee schedule defines how much fee to compute — the currency, rounding, and one or more fee items (flat, percentage, tiered, or expression-based).
  • A fee rule decides when a fee schedule applies. It belongs to a reconciliation context, targets a matching side, and carries predicates that a transaction’s metadata must satisfy. When the predicates match, the rule selects its fee schedule.
When fee normalization is enabled and the transaction and schedule currencies match, modeling expected fees this way lets Matcher account for predictable charges before comparing transactions.

What fee handling solves


Reconciliation fails when one side of a transaction includes fees or charges that the other side doesn’t record. A payment gateway deducts a processing fee before settling. A bank charges a wire transfer fee. An acquirer nets fees against payouts. Without modeled fees, Matcher treats these differences as amount mismatches and generates exceptions — even when the difference is expected and documented. Fee schedules describe the charge, and fee rules select when to use it during enabled fee normalization.

How rules and schedules fit together


A fee rule does not contain the fee amount or calculation itself. It references a fee schedule by ID and applies it to the transactions its predicates select.
  1. A fee schedule is created once at the tenant level and can be reused by many rules across many contexts.
  2. A fee rule is created inside a context. It sets a side, a feeScheduleId, a priority, and a list of predicates.
  3. When Matcher processes a context with fee normalization enabled, it evaluates the relevant side’s fee rules in priority order (lowest first). The first matching rule selects the referenced schedule.
This separation means you change how a fee is computed by editing the schedule, and change when it applies by editing the rule — without touching the other.
A fee rule alone does not change comparison amounts. Fee-rule evaluation affects fee reconciliation only when the context sets feeNormalization to NET or GROSS, the relevant side has rules, and the transaction and schedule currencies match.

Fee rule structure


A fee rule belongs to a context and has the following fields.

Predicates

Each predicate tests one transaction metadata field with an operator. Available operators: Missing fields evaluate to false for every operator except EXISTS.

Fee schedule structure


A fee schedule is a tenant-level entity that computes a fee from a gross amount.

Fee items

Each item declares a name, a priority (application order, relevant for CASCADING), a structureType, and a type-specific structure.

Managing fee schedules


Fee schedules are tenant-scoped and managed independently of any context.

Create a fee schedule

This schedule computes a 2.9% processing fee on the gross amount, denominated in BRL.
cURL

Simulate a fee schedule

Before wiring a schedule into a rule, simulate it against a gross amount to confirm the computed fee.
cURL
The response returns the netAmount, totalFee, and a per-item breakdown.
A fee schedule cannot be deleted while a fee rule or fee-variance history references it. The delete request returns 409 Conflict with the code MTCH-0108; the API problem does not list the blocking contexts. Remove or repoint current rule references first. Historical variance references continue to block deletion.

Managing fee rules


Fee rules are created inside a context and reference a fee schedule.

Create a fee rule

This rule applies the fee schedule created above to right-side transactions whose institution metadata equals Banco do Brasil.
cURL

End-to-end flow


Putting it together, expected-fee handling follows three steps:
1

Create the fee schedule

Define how the fee is computed once at the tenant level with POST /v1/fee-schedules. Optionally validate it with the simulate endpoint. Note the returned id.
2

Create the fee rule in the context

Inside the reconciliation context, create a fee rule with POST /v1/contexts/{contextId}/fee-rules. Set feeScheduleId to the schedule’s id, choose the side, set a unique priority, and add the predicates that select the transactions the fee applies to.
3

Apply during matching

Set the context’s feeNormalization to NET or GROSS. During matching, Matcher evaluates rules for each relevant side in priority order. A matching rule changes the comparison amount only when its schedule and the transaction use the same currency.

Best practices


A fee schedule is tenant-scoped and can be referenced by many rules. Define a schedule once (e.g. “Card Processing - Visa”) and point rules in different contexts at it. Editing the schedule updates every rule that uses it.
Priorities are unique within a context and shared across LEFT, RIGHT, and ANY rules. Order them from most specific to most general so a narrow rule wins before a broad fallback.
Predicates are ANDed together and tested against transaction metadata. Combine operators (EQUALS, IN, BETWEEN, EXISTS) to target exactly the transactions a fee applies to and avoid unintended fee attribution.
Use POST /v1/fee-schedules/{scheduleId}/simulate to confirm a schedule produces the expected fee for representative amounts before referencing it from a rule.
A schedule referenced by a rule or fee-variance history cannot be deleted (409 MTCH-0108). The conflict response does not list blocking contexts. Update or remove current rule references first; historical variance references continue to block deletion.

Next steps


Match rules

Configure how transactions are compared once expected fees are accounted for.

Exception routing

Review explicit assignment, dispatch, and callback behavior for exceptions that fee handling doesn’t cover.

Fee schedules API

Full API reference for fee schedule endpoints.

Fee rules API

Full API reference for fee rule endpoints.