---
title: Reconciliation contracts and expected amounts
description: The terms each agency, gateway or marketplace works to, kept as dated versions, and the calculator that works out what a transaction should have cost and paid, with the clause behind every figure.
section: finance
order: 70
audience: [user, operator, agent]
sources: [services/nodejs-cloud/lib/finance/recon/contracts/terms.ts, services/nodejs-cloud/lib/finance/recon/contracts/expected.ts, services/nodejs-cloud/lib/finance/recon/contracts/store.ts, services/nodejs-cloud/lib/finance/recon/contracts/mcp.ts, services/nodejs-cloud/app/(finance)/finance/recon/contracts, services/nodejs-cloud/components/finance/recon, services/nodejs-cloud/migrations/0437_fin_recon_contracts.sql]
features: [cloud.page-finance]
---

A **contract** records what a counterparty may keep and when it must pay you: a travel agency's commission, a payment
gateway's fees, a marketplace's payout delay. Reconciliation uses it to work out what you should have received, so a
shortfall has a number and a clause you can point to. Contracts are part of the Reconciliation module
(`finance.recon`); they live in **Finance > Reconciliation** (`/finance/recon/contracts`), and one opens at
`/finance/recon/contracts/view?id=…`.

## Contracts and versions {#versions}

A contract belongs to one entity and is with one [party](/docs/finance/parties.md): a party the group shares, or one of that entity.
It has a name, an optional reference (the contract's own number) and a currency. Every amount in its terms is in that
currency.

Terms change over time, so a contract keeps **versions**. Each version has a first day (`valid_from`) and a last day
(`valid_to`, inclusive, or none for open-ended), its terms, an optional signed copy from
[Finance documents](/docs/finance/documents.md) and a note. Two versions of one contract never share a day; the database refuses it.
When you add a version that starts after the open-ended current one, the current one is closed the day before. A
transaction is always worked out under the version in force on its date.

The entity, the party and the currency do not change. To move a contract, set it inactive and add a new one.

## Terms {#terms}

Amounts are whole **minor units** written as text (`"250"` is 2.50 in a two-decimal currency). Percents are text with at
most four decimal places (`"15"`, `"2.95"`). A fractional JSON number such as `15.5` is refused: write `"15.5"`. Nothing
in a contract or its calculation passes through a floating-point number.

A **charge** is one of:

| Charge | Example | What it does |
|---|---|---|
| `percent` | `{"type":"percent","percent":"15"}` | A percent of the amount. |
| `fixed` | `{"type":"fixed","amount_minor":"250"}` | A fixed amount per transaction. It never applies to a refund. |
| `tiered`, `whole` | `{"type":"tiered","basis":"whole","measure":"amount","tiers":[{"up_to_minor":"100000","percent":"15"},{"up_to_minor":null,"percent":"12"}]}` | The whole amount at the percent of the tier it falls in. `measure: "period_volume"` picks the tier by the counterparty's volume so far in the period instead. |
| `tiered`, `marginal` | the same with `"basis":"marginal"` | Each slice of the amount at its own tier's percent, like tax brackets. |

Tiers go up; an upper bound is inclusive (an amount of exactly `100000` is in the first tier above) and the last tier is
open (`null`). Any charge can take `min_minor` (a floor) and `max_minor` (a cap) on its result.

The terms object:

| Key | Default | What it says |
|---|---|---|
| `collects` | `counterparty` | Who takes the customer's money. `counterparty`: it pays you the net. `us`: you collect and owe it its charges. |
| `rounding` | `half_up` | How each charge is rounded to the minor unit: `half_up` (a half away from zero), `half_even`, `down` (toward zero) or `up` (away from zero). |
| `commission` | required | `default` (a charge), plus `by_rate_plan` and `by_category` (a name to a charge each). A rate plan's charge wins over a category's, a category's over the default. |
| `fees` | none | Up to 20 fees: `key`, `label`, `charge`, `when` (`always`, `counterparty_collects` or `we_collect`) and `on_refund` (`keep`: not given back on a refund, the default; or `reverse`). |
| `tax_on_commission` | none | `percent`, `on` (`commission` or `commission_and_fees`) and `included` (true when the commission already contains the tax: it is shown, not added). |
| `payout` | none | `delay_days` and `from`: `date` (the transaction's date), `service_end` (a stay's checkout) or `month_end`. |
| `no_show`, `cancellation` | standard | `commission`: `"standard"` (as a sale), `"none"`, or a charge of its own. |
| `refund` | reverse | `commission`: `reverse` (the commission comes back with the refund) or `keep`. |

An example, a travel agency at 15% (12% on non-refundable rates), a 2% payment fee when it collects, 9% tax on its
commission, paying 7 days after checkout:

```json
{
  "collects": "counterparty",
  "commission": { "default": { "type": "percent", "percent": "15" }, "by_rate_plan": { "NONREF": { "type": "percent", "percent": "12" } } },
  "fees": [{ "key": "payment", "label": "Payment fee", "charge": { "type": "percent", "percent": "2" }, "when": "counterparty_collects" }],
  "tax_on_commission": { "percent": "9" },
  "payout": { "delay_days": 7, "from": "service_end" },
  "no_show": { "commission": "none" }
}
```

The page's **Add contract** and **Add version** take the simple form: one commission percent, a payment fee percent, a
fixed fee, tax on the commission, the payout delay and who collects. Rate plans, categories, tiers, caps and the no-show,
cancellation and refund rules are set over the API or MCP.

## Expected amounts {#expected}

For one transaction (a reservation, an order, a sale: its date, its gross amount, and optionally its kind, rate plan,
category, end of service and the period's volume), the calculator works out, under the version in force on its date:

- the **commission**, from the rate plan's, the category's or the default charge, or the no-show, cancellation or refund
  rule;
- each **fee** that applies;
- the **tax** on the commission;
- the **net**: what the counterparty owes you (the gross less commission, fees and tax), or, when you collect, minus what
  you owe it;
- the **due date** of the payout.

Each charge is rounded once, by the contract's rounding. A marginal tier schedule adds its slices exactly and rounds the
sum. A refund is worked on its size and given back its sign. The answer carries the **working**: one line per clause
(`commission.by_rate_plan.NONREF`, `fees.payment`, `tax_on_commission`, `payout`), with the basis, the percent, the tier
and the result, so a claim can cite the clause.

Give it what the statement and the bank showed (the commission taken, the fees charged, what was paid and when) and it
also returns **findings**, each with the expected amount, the actual amount and the difference:

| Finding | When |
|---|---|
| `over_commission` | More commission was taken than the contract allows. A 15% contract against an 18% deduction on 1,000.00 is 30.00. |
| `fee_mismatch` | The fees differ from the contract's, either way. |
| `short_payment` | The payout is short by more than the commission and fees already explain. |
| `missing_payout` | No payout, and the check date is past the due date (plus any grace days). Due 7 days after the date and still absent at day 10: missing, 3 days late. |
| `late_payout` | Paid after the due date (plus any grace days). |

A difference within `tolerance_minor` is no gap. A transaction in another currency is refused: converting it, and any
FX difference, is reconciliation's work, not the contract's.

## Who may do what {#roles}

Reading contracts and working out expected amounts needs `recon.read` on the contract's entity (a controller, a
`recon_clerk`, an `auditor`); adding or changing one needs `recon.run` (a controller or a `recon_clerk`). A contract on an
entity you cannot see answers as an unknown id. See [Finance roles](/docs/finance/roles.md). Every change is recorded on the
[event chain](/docs/finance/audit-trail.md) (`finance.recon_contract.created`, `.updated`, `.version_added`, `.deactivated`) with the
contract and its versions before and after. An organisation without Reconciliation gets `403 product_not_enabled`.

## Tools and API {#tools}

| Tool | REST | What it does |
|---|---|---|
| `finance_reconcontract_create` | `POST /api/v1/finance/recon-contracts` | Add a contract and its first version (`terms`, or the simple `form`). |
| `finance_reconcontract_list` | `GET /api/v1/finance/recon-contracts` | The contracts you may see; `entity_id`, `counterparty_party_id`, `active`, `on_date`, `query`. |
| `finance_reconcontract_get` | `GET /api/v1/finance/recon-contracts/{id}` | One contract with every version. |
| `finance_reconcontract_update` | `PATCH /api/v1/finance/recon-contracts/{id}` | Rename, set inactive, change one version (`version`), or add one (`add_version`). |
| `finance_reconcontract_evaluate` | `POST /api/v1/finance/recon-contracts/{id}/evaluate` | A transaction's expected amounts and working, and the findings given `actual`. Changes nothing. |

Reads take the OAuth scope `finance:read`, changes `finance:write`.
