> ## Documentation Index
> Fetch the complete documentation index at: https://docs.switch.vaultera.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Rule-Based Routing

**Route transactions through processors using advanced rules based on payment parameters**

***

## 🚀 Get Started with Rule-Based Routing

**Rule-Based Routing** allows you to define smart, flexible routing logic for payments by configuring rules that determine which processor(s) should handle a transaction, based on specific conditions.

A **routing rule** consists of:

* **Conditions** (what must be true to trigger the rule)
* **Processor preferences** (which processor(s) to use when the rule matches)

Rules are evaluated **sequentially from top to bottom**. The **first matched rule** is applied, and the associated processor preference is used.

***

## 🧩 Components of Rule-Based Routing

### ✅ Conditions

Conditions are built using **payment dimensions** (e.g., currency, amount, payment method) and **logical operators**, such as:

* `equal to`
* `greater than` / `less than`
* `is` / `is not`
* `contains` / `not contains`

Example:
“If the currency is `USD` and amount > `10000`, route to Processor X.”

***

### 🎯 Processor Preferences

Each rule points to a **Processor Preference**, which defines how the transaction should be routed if the rule is triggered. You can choose from:

* **Single Processor**:
  Use one processor (e.g., `Stripe`)

* **Split Routing**:
  Distribute the volume across multiple processors
  Example: `Stripe (70%)`, `PayPal (30%)`

* **Processor with Fallback(s)**:
  Use a primary processor, with fallback options in case of failure
  Example: `Primary: Stripe`, `Fallback: PayPal`

***

## 🛠️ Steps to Configure Rule-Based Routing in Smart Router

### Step 1: Click on **Setup** for Rule-Based Configuration

### Step 2: Name Your Rule

Give the rule a **name** and an optional **description** for clarity.

### Step 3: Build Your Rule

Use the **no-code UI** to define conditions and associate them with the right processor(s).
Example UI:

```plaintext theme={"system"}
Condition: currency = "USD" and amount > 5000  
Processor: Stripe (Primary), PayPal (Fallback)
```

### Step 4: Select Default Processors

If none of the rules match, your **default processor preference** will be used.

### Step 5: Save & Activate

In the confirmation popup, choose between:

* **Save Only**: Store the rule without making it live
* **Save & Activate**: Immediately apply the rule to all new payments

### Step 6: Monitor & Manage Rules

View, edit, or deactivate your rules anytime from the **Vaultera Switch Dashboard** under **Smart Router > Rule-Based Routing**.

***

## 🔄 How Rule-Based Routing Works

1. A payment is initiated.
2. Routing engine checks each rule in order.
3. The first matching rule is selected.
4. The defined processor (or routing strategy) is applied.
5. If no rule matches, the **default fallback processor** is used.
