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

# RTO V2

> Build RTO rules, configure Partial COD per rule, and choose whether one rule or all matching rules apply.

In V2, every restriction is a **rule**. A rule has:

* **Name** and an **active** toggle.
* **Condition** — what makes the rule match an order (cart amount, pincode, product, and so on).
* **COD setting** — whether COD stays available when the rule matches.
* **Partial COD setting** — whether Partial COD stays available, plus how the prepaid amount is calculated.
* **COD charge increment** *(COD usage penalty rules only)* — how much extra COD fee to add.

Pick a rule type from the RTO Suite page, then use **Add rule**. Setup runs in two steps.

### Step 1 — Setup

Name the rule, set its condition, then use **Payment availability** to decide what survives when the rule fires:

* **Allow Cash on Delivery** — leave it off to block COD on matching orders, or on to keep COD available (useful when the rule only exists to force a Partial COD prepayment).
* **Allow Partial COD** — turn it on to continue to step 2 and configure the upfront amount. Turn it off and **Next** becomes **Create**; the rule finishes at step 1.

<Frame caption="RTO Suite → Filter based on cart amount → Add rule — step one sets the condition and which payment options survive when the rule fires.">
  <img className="rounded-lg" src="https://mintcdn.com/flexype/rOvGpwJN2Ni_winT/images/rtosuite/rto-rule-setup.jpg?fit=max&auto=format&n=rOvGpwJN2Ni_winT&q=85&s=e55a4140bf1de7d6241ae9379b0340b1" alt="Create filter based on cart amount dialog on step one of two, with rule name, minimum cart amount, and Payment availability toggles for Allow Cash on Delivery turned off and Allow Partial COD turned on" width="1523" height="806" data-path="images/rtosuite/rto-rule-setup.jpg" />
</Frame>

### Step 2 — Partial COD

This step only appears if you allowed Partial COD. It answers one question: **how should the upfront amount be calculated?**

<Frame caption="Step two of Add rule — pick how the prepaid amount is calculated, and optionally require a minimum order value before Partial COD is offered.">
  <img className="rounded-lg" src="https://mintcdn.com/flexype/rOvGpwJN2Ni_winT/images/rtosuite/rto-rule-partial-cod.jpg?fit=max&auto=format&n=rOvGpwJN2Ni_winT&q=85&s=b9ac751e063938db011122ce41b9ac92" alt="Partial COD setup step showing four upfront amount methods — fixed upfront amount, only the COD fee, percentage of order total including COD fee, percentage of order total excluding COD fee — with Only the COD fee selected and a Minimum order value field below" width="1523" height="806" data-path="images/rtosuite/rto-rule-partial-cod.jpg" />
</Frame>

| Method                                        | Customer prepays                                           | Extra field            |
| --------------------------------------------- | ---------------------------------------------------------- | ---------------------- |
| **Fixed upfront amount**                      | The same flat amount on every triggered order              | Upfront amount (₹)     |
| **Only the COD fee**                          | The COD fee upfront, the rest on delivery                  | —                      |
| **Percentage of order total (incl. COD fee)** | A share of the order total, COD fee included in the base   | Upfront percentage (%) |
| **Percentage of order total (excl. COD fee)** | A share of the order total, COD fee excluded from the base | Upfront percentage (%) |

<Frame caption="Choosing a percentage method swaps the amount field for an Upfront percentage input.">
  <img className="rounded-lg" src="https://mintcdn.com/flexype/rOvGpwJN2Ni_winT/images/rtosuite/rto-rule-partial-cod-percentage.jpg?fit=max&auto=format&n=rOvGpwJN2Ni_winT&q=85&s=9b91d30d33c70ef87bfd45653c0a0f18" alt="Partial COD setup step with Percentage of order total excluding COD fee selected, showing an Upfront percentage field with a percent suffix" width="1523" height="806" data-path="images/rtosuite/rto-rule-partial-cod-percentage.jpg" />
</Frame>

**Minimum order value** applies Partial COD only above the amount you enter. Leave it at `0` to offer Partial COD on every order the rule matches.

<Note>
  On **cart amount** rules there is no separate minimum order value on step 2 — the minimum you set as the rule's condition in step 1 already does that job.
</Note>

Finish with **Create**. Use **Back** to return to step 1 without losing what you entered.

***

At checkout, FlexyPe builds an evaluation context from the live cart and customer, finds every active rule that matches it, then applies them according to your **rule application mode**.

***

## Rule types

Rules are grouped into two sections on the RTO Suite page.

### Order & cart rules

Conditions based on the cart and the customer's order history.

| Rule                                      | Matches when                                                                                  |
| ----------------------------------------- | --------------------------------------------------------------------------------------------- |
| **Filter based on cart amount**           | Cart subtotal falls between the min and max you set                                           |
| **Filter based on cart item count**       | Total item quantity falls between the min and max you set                                     |
| **Filter based on total COD order count** | The customer's COD order count has reached your limit (optionally within a recent day window) |
| **Filter based on returned orders**       | The customer has at least *N* returned, cancelled, or refunded orders within *X* days         |

### Customer & product filters

Conditions based on who is buying, where it ships, and what is in the cart.

| Rule                            | Matches when                                                     |
| ------------------------------- | ---------------------------------------------------------------- |
| **Filter based on user**        | The shopper's phone number is in the uploaded user list          |
| **Filter based on pincode**     | The shipping PIN code is in the uploaded PIN code list           |
| **Filter based on state**       | The shipping state is one of the states you selected             |
| **Filter based on products**    | The cart contains any of the selected products                   |
| **Filter based on collections** | The cart contains a product from any of the selected collections |

### Risk rules

Two further rule types exist in the platform and can be enabled for your store on request:

* **High-risk pincode** — matches when the shipping PIN code has accumulated more than 10 returned COD orders on your store.
* **COD usage penalty** — matches any customer who has placed at least one COD order, and adds an escalating COD fee instead of blocking COD. Levels run from `increment_1` to `increment_5`, chosen by the customer's COD order count and capped by the rule's maximum increments. The increment is a fixed amount or a percentage of the base COD charge.

## Partial COD in V2

Partial COD is configured **per rule**, not globally — each rule carries its own calculation method, upfront amount, and minimum order value, set in step 2 of rule setup above.

This matters when rules overlap. If the cart subtotal is below a rule's minimum order value, that rule contributes no Partial COD — and in **All rules together** mode, that is enough to make Partial COD unavailable for the whole order.

***

## How multiple rules combine

A real cart often matches several rules at once — for example a high-value cart shipping to a restricted PIN code. The **rule application mode** decides what happens then.

Open **RTO Suite** and use the card at the top of the page: *Choose how your RTO rules are applied*.

<Frame caption="RTO Suite — “All rules together” is the recommended mode; the selected option applies to your live checkout as soon as you confirm.">
  <img className="rounded-lg" src="https://mintcdn.com/flexype/rOvGpwJN2Ni_winT/images/rtosuite/rto-version-switch.png?fit=max&auto=format&n=rOvGpwJN2Ni_winT&q=85&s=3c94150531490a8042fa07cdc493625a" alt="Choose how your RTO rules are applied card with two options: Single rule, currently selected, and All rules together marked Recommended" width="1568" height="287" data-path="images/rtosuite/rto-version-switch.png" />
</Frame>

| Mode                                   | Behaviour                                                                                 |
| -------------------------------------- | ----------------------------------------------------------------------------------------- |
| **Single rule**                        | Only the highest priority matching rule is applied. All other matching rules are ignored. |
| **All rules together** *(recommended)* | Every matching rule is applied, and the strictest outcome wins.                           |

The change applies to your **live checkout immediately**, so the dashboard asks you to confirm before saving.

### Single rule

Matching rules are sorted, and only the first one is used.

Rules that have Partial COD enabled are considered first. Within that, the priority order is:

1. Cart amount
2. User
3. Pincode
4. State
5. Returned order
6. Order count
7. High-risk pincode
8. Product
9. Collection
10. Cart item count
11. COD usage penalty

Whatever that single rule says — COD blocked or allowed, Partial COD on or off, penalty charged or not — is the final answer. A stricter rule further down the list has no effect.

### All rules together

Every matching rule is evaluated, and the outcomes are combined:

* **COD** starts available and is switched off if **any** matching rule blocks it. COD usage penalty rules never block COD on their own — they only change the fee.
* **Partial COD** starts available as soon as at least one rule matches, and is switched off if **any** matching rule disables it, or if a rule's minimum order value is not met by the cart.
* **Partial COD amount**, when Partial COD survives, is the **highest** eligible prepaid amount across matching rules.
* **COD fee**, when several COD usage penalty rules match, uses the **highest** increment among them — increments are never stacked.

In short: blocking beats allowing, and the largest prepayment or penalty wins.

The order also records one **applied rule** for reporting, chosen in this order: the first rule that blocked COD, then the first rule that blocked or invalidated Partial COD, then the rule that produced the largest COD penalty.

### Worked example

A cart of ₹4,500 shipping to a restricted PIN code, from a customer with 3 previous COD orders. Three rules match:

| Rule                       | COD         | Partial COD | Prepaid amount      |
| -------------------------- | ----------- | ----------- | ------------------- |
| Cart amount ₹3,000–₹10,000 | Allowed     | Enabled     | ₹450 (10% of order) |
| Pincode restricted list    | **Blocked** | Enabled     | ₹900 (20% of order) |
| COD usage penalty          | Allowed     | —           | Adds ₹50 COD fee    |

**Single rule** — Cart amount has the highest priority, so COD stays available, Partial COD is offered at ₹450, and no penalty is charged. The PIN code restriction is ignored.

**All rules together** — the PIN code rule blocks COD, so COD is removed from checkout entirely. Partial COD is allowed by both rules that mention it, so it is offered at the higher amount, ₹900.

### Which mode should you use?

* **All rules together** is recommended. It is the safer default: every restriction you configure actually takes effect, so a rule cannot be silently overridden by a higher-priority one.
* **Single rule** is useful when you want narrow, targeted exceptions and prefer predictable, one-reason behaviour per order.

<Warning>
  Before switching to **All rules together**, review your active rules.
  Restrictions that were previously masked by a higher-priority rule become
  live, so COD may disappear for carts where it used to show.
</Warning>

### After switching

1. Confirm the mode shown on the RTO Suite page is the one you selected.
2. Place a test order that matches a single rule and confirm COD and Partial COD behave as expected.
3. Place a test order that matches several rules and confirm the strictest outcome is applied.
4. Check that a cart below a rule's minimum order value no longer sees Partial COD.
