---
title: Finance payment settlement and cash
description: Released payments are marked settled when your bank statement shows them leaving, bills become paid, and returned payments open their bills again. The cash forecast shows money going out and coming in by week.
section: finance
order: 76
audience: [user, operator, agent]
sources: [services/nodejs-cloud/lib/finance/payments/settlement.ts, services/nodejs-cloud/lib/finance/payments/settlement-pure.ts, services/nodejs-cloud/lib/finance/payments/cash.ts, services/nodejs-cloud/lib/finance/payments/settlement-mcp.ts, services/nodejs-cloud/app/(finance)/finance/payments/settlement, services/nodejs-cloud/app/(finance)/finance/payments/cash, services/nodejs-cloud/migrations/0459_fin_payment_settlement.sql]
features: [cloud.page-finance]
---

A released payment run is an instruction to your bank. **Settlement** is how Finance learns what the bank actually did.
It reads your bank statement, finds the payments in it, and marks them settled. Their bills become paid. If the bank
gives a payment back, the payment is marked returned and its bills are open again.

**Petawork never moves money.** Settlement only reads statement lines you already imported into Reconciliation. It
sends nothing to your bank and calls no bank or payment provider.

Settlement is part of Payments (`finance.payments`). A run's settlement is on the run's **Settlement** tab
(`/finance/payments/settlement?id=<run id>`). The forecast is in **Finance > Payments > Cash** (`/finance/payments/cash`).

## Before you start {#setup}

1. In Reconciliation, add a bank source for the account and import its statements
   ([Reconciliation sources](/docs/finance/reconciliation-sources.md)).
2. In **Finance > Payments > Bank accounts**, set the bank account's statement source (`recon_source_id`) to that source
   ([Finance payments](/docs/finance/payments.md#calendars)).

A bank account with no statement source cannot be settled. The tool says so.

## Reading the statement {#read}

**Read bank statement** on the Settlement tab (or `finance_settlement_run`) reads the account's statement lines from the
last 90 days (`from` and `to` change the window). Each line is read once. A line that settled or returned something is
never read again.

Finance pairs the lines with the payments of the account's released runs. It uses the reconciliation engine and a
built-in set of rules, written in the same rule language as your own rulesets
([reconciliation rules](/docs/finance/reconciliation-rules.md)):

| Rule | A statement line that | What happens |
|---|---|---|
| `settle_exact` | is a debit with one payment's reference and its exact amount | The payment is settled now |
| `settle_run` | is a debit with a run's number and the exact total of its open payments (a bulk debit) | Every payment of the run is settled now |
| `settle_reference` | is a debit whose text contains a payment's reference as one word, with the exact amount | Waits for a person |
| `settle_run_reference` | is a debit whose text contains a run's number, with the exact total | Waits for a person |
| `settle_run_mismatch` | is a debit with a run's number, but a different amount | A `settlement_mismatch` exception; nothing is settled |
| `settle_mismatch` | is a debit with one payment's reference, but a different amount | A `settlement_mismatch` exception; nothing is settled |
| `return_exact` | is a credit with a settled payment's reference and amount | The payment is returned now |
| `return_reference` | is a credit whose text contains a payment's reference, with the exact amount | Returned now if the line carries a return code, else waits for a person |

References are compared without case, spaces, punctuation or leading zeros, so `INV-0042` and `inv 42` are the same.

**What settles by itself and what waits.** Only exact matches settle without a person: the reference and the amount are
the same, or a bulk debit names the run and equals its total. A match on a reference found inside a longer narrative waits
for a person. So does an exact match that is not unique: two open payments, or two statement lines, with the same
reference and amount. Any amount that differs is never settled. It raises an exception instead, saying whether the bank
took less (short) or more (over).

A match that waits is a **proposal**. It shows under **Waiting for you** on the Settlement tab with **Confirm** and
**Dismiss**. Confirming applies it as an exact match would have been. Dismissing it, with a reason, changes nothing else
and frees the statement line for another match.

### What settling does {#settle}

In one transaction:

- each payment becomes `settled`, with the statement line's date and reference;
- each bill it paid becomes `paid`, or `partly_paid` if some of it is still open;
- the payment journal is recorded against the settlement. That is the journal the run proposed when it was released
  ([journals](/docs/finance/journals.md)). If release could not make one (no ledger account then), settling proposes one for the
  payment;
- once every payment of the run is settled or returned, the run becomes `settled`; before that it is `partly_settled`.

After the transaction, `finance.bill.paid` goes out for each bill that became paid and `finance.payment_run.settled`
for the run, each once ([webhook events](/docs/finance/events.md)).

Reading the same statement again changes nothing. Two people reading it at the same time cannot settle a payment twice:
the database allows one settlement per payment and one use per statement line.

### Returned payments {#returns}

A bank sometimes sends a payment back, for example because the payee's account was closed. When a credit on the
statement gives back a payment:

- the payment becomes `returned`;
- its bills are open again (`approved`, or `partly_paid` if something else paid part of them), and are free for a new run;
- a reversing journal is posted for that payment's part of the payment journal;
- a `payment_returned` exception is raised, once.

A returned payment is **never paid again by itself**. Nothing is retried and nothing is put in a run. A person works the
exception and proposes a new run when the payee's bank details are right.

A credit counts as a return by itself when its reference and amount are the payment's, or when it names the payment and
carries a return code: an ISO 20022 reason code such as `AC04` or `MS03`, or a word such as `RETURN`, `RTN` or `REJECTED`.

## Who can do what {#roles}

| Action | Needs |
|---|---|
| Read settlements, the forecast and the reports | `reports.read` on the entity (controller, payment preparer, auditor) |
| Read the statement, confirm or dismiss a proposal | `recon.work` on the bank account's entity (controller, reconciliation clerk) |

An agent may read a statement or confirm a proposal only within its job's authority: a rule granting `recon.work`,
document type `payment_settlement`, with any amount, currency, confidence or difference limits you set. Without one, its
call becomes a recommendation for a person ([Finance agents](/docs/finance/agents.md)). No agent ever releases or exports a run.

## Cash {#cash}

**Finance > Payments > Cash** shows money going out and coming in by week, per entity and currency, for 4, 13 or 26
weeks. It is worked out each time you open it, from:

| Out | When |
|---|---|
| Approved bills (also scheduled and partly paid), what is still open | Their due date, unless a payment run holds them. A bill whose payment is held in a run counts here, by its due date |
| Bills in approval | Their due date |
| Payment runs not yet settled, their payments that are not held | The run's value date |
| Approved expense reports not yet paid (reimbursements) | This week |

| In | When |
|---|---|
| Issued sales invoices, what is still open | Their due date |

An item that is overdue, or has no date, counts in this week. Weeks start on Monday.

The **opening balance** is the latest closing balance of the entity's bank statements in that currency, from a
statement source that has one (MT940, CAMT.053 and some OFX files carry it). Each week's closing follows from it. Without
one, the closing is left empty.

Currencies are never added together: each currency has its own chart and table. Under them, the weekly net of all the
entity's currencies is also shown in its functional currency at today's rate, when every currency has a rate
([reference data](/docs/finance/reference-data.md)).

Purchase orders and recurring commitments are not in the forecast yet.

### Reports {#reports}

Under the forecast:

- **Days payable outstanding** per vendor and entity: what you still owe the vendor now, divided by what they billed in
  the last 90 days, times 90.
- **Off-cycle runs** by the person who proposed them, with each run's reason and total, from the last 90 days
  ([off-cycle runs](/docs/finance/payments.md#off-cycle)).

## Tools {#tools}

| Tool | What it does |
|---|---|
| `finance_settlement_run` | Read a bank account's statement and settle, return or propose |
| `finance_settlement_list` | Settlements, returns and proposals (`status`: `proposed`, `done`, `dismissed`) |
| `finance_settlement_confirm` | Confirm a proposal |
| `finance_settlement_dismiss` | Dismiss a proposal with a reason |
| `finance_cashforecast_get` | The cash forecast (`entity_id`, `currency`, `weeks` 1 to 26) |
| `finance_paymentreport_get` | `report`: `dpo` or `off_cycle`; `days` 1 to 366 |

Each has a REST twin under `/api/v1/finance`: `POST /bank-accounts/{bank_account_id}/settle`, `GET /settlements`,
`POST /settlements/{id}/confirm`, `POST /settlements/{id}/dismiss`, `GET /cash-forecast` and
`GET /payment-reports/{report}`.

## For module builders {#builders}

The tables are `fin_payment_settlements` (one row per statement line used: settle or return, proposed, done or
dismissed) and `fin_payment_settlement_items` (what a done row did to each payment). Migration 0459 also adds the
indexes the forecast reads. The rules are in `settlement-pure.ts`; they run through the reconciliation engine unchanged.
