> ## 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.

# Context fee rules

> Bind fee schedules to the transactions of a context with side and field predicates, from the Fee Rules tab in the Matcher module of Lerian Console.

Use the **Fee Rules** tab of a context to decide which fee schedule applies to which transactions. A fee rule binds one fee schedule to the context. Its side and its predicates select the transactions that the schedule applies to. Matcher uses that schedule to compute the expected fee of each selected transaction.

You define the fee schedules themselves in **Settings → Fee Schedules**. See [Managing fee schedules](/en/products/matcher/ui/managing-fee-schedules).

## Accessing the Fee Rules tab

***

<Steps>
  <Step>
    In the Matcher module, select **Configure → Contexts**.
  </Step>

  <Step>
    Click a context to open its detail page.
  </Step>

  <Step>
    Select the **Fee Rules** tab.
  </Step>
</Steps>

The **Create rules** step of the [Context setup wizard](/en/products/matcher/ui/context-setup-wizard) also shows this tab when Matcher asks for a fee rule.

## Fee rule list

***

The table lists the fee rules of the context in priority order:

| Column | Description |
| - | - |
| **Name** | The fee rule name |
| **Side** | **Left side**, **Right side**, or **Either side** |
| **Priority** | The evaluation order. Matcher checks lower numbers first |
| **Fee schedule** | The fee schedule that the rule applies |
| **Predicates** | The number of predicates in the rule |
| **Actions** | Pencil button to edit the rule and trash button to delete it |

## How Matcher picks a fee schedule

***

For each transaction, Matcher checks the fee rules of the transaction's side in priority order. A rule with **Either side** applies to both sides. The first rule whose predicates all match decides the fee schedule. A rule with no predicates matches every transaction on its side.

## Creating a fee rule

***

<Steps>
  <Step>
    Click **New fee rule**. The **New fee rule** side sheet opens.
  </Step>

  <Step>
    Fill in the rule:

    | Field | Description |
    | - | - |
    | **Name** (required) | A name of up to 100 characters. Each fee rule of a context needs a different name |
    | **Side** | **Left side**, **Right side**, or **Either side** (default) |
    | **Priority** | A number of 0 or more. The form proposes the number after the highest priority in use. Each fee rule of a context needs a different priority |
    | **Fee schedule** (required) | The fee schedule to apply. The list shows each schedule with its currency |
  </Step>

  <Step>
    Add the predicates. Click **Add predicate** to add one. Click **Remove predicate** on a predicate to remove it. See [Predicates](#predicates).
  </Step>

  <Step>
    Click **Save**.
  </Step>
</Steps>

## Predicates

***

A predicate tests one metadata field of the transaction. Transaction metadata holds the source columns that the field map does not map. See [Context field maps](/en/products/matcher/ui/context-field-maps).

Each predicate has these fields:

* **Field**: the metadata field to test. Type the column name as it appears in the source data.
* **Operator**: the comparison to make.
* **Value**, **Values**, or **Lower bound** and **Upper bound**: what to compare with. The form shows the fields that the operator needs.

| Operator | Matches when |
| - | - |
| `EQUALS` | The field equals the **Value** |
| `NEQ` | The field does not equal the **Value** |
| `IN` | The field equals one of the **Values**. Click **Add value** to add a value |
| `EXISTS` | The field is present, whatever its value |
| `GT` | The field is greater than the **Value** |
| `GTE` | The field is greater than or equal to the **Value** |
| `LT` | The field is less than the **Value** |
| `LTE` | The field is less than or equal to the **Value** |
| `BETWEEN` | The field is between the **Lower bound** and the **Upper bound**, both included |

`EQUALS` and `IN` compare text without regard to case. `GT`, `GTE`, `LT`, `LTE`, and `BETWEEN` need numbers. A field that is not a number never matches them. A predicate on a field that the transaction does not have never matches.

## Editing a fee rule

***

Click the pencil button on a rule row. The **Edit fee rule** side sheet opens with the current values. Change the fields and click **Save**.

## Deleting a fee rule

***

Click the trash button on a rule row. A **Remove the fee rule** dialog opens with the rule name. Click **Confirm** to delete the rule.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.