---
title: Purchase orders
description: Payables' purchase orders, goods receipts and the two- and three-way match. Order from a vendor, have it approved and numbered, record what arrives, and let each bill be checked against what was ordered and received within your tolerances.
section: finance
order: 48
audience: [user, operator, agent]
sources: [services/nodejs-cloud/lib/finance/payables/purchase-orders.ts, services/nodejs-cloud/lib/finance/payables/po-pure.ts, services/nodejs-cloud/lib/finance/payables/match.ts, services/nodejs-cloud/lib/finance/payables/po-match.ts, services/nodejs-cloud/lib/finance/payables/po-mcp.ts, services/nodejs-cloud/app/(finance)/finance/purchase-orders, services/nodejs-cloud/migrations/0439_fin_purchase_orders.sql]
features: [cloud.page-finance]
---

A **purchase order** is what you agreed to buy from a vendor, before the bill arrives. It lives in
**Finance > Purchase orders** (`/finance/purchase-orders`), part of the Payables module (entitlement `finance.payables`).
When Payables is off, the page says so and every purchase order tool answers 403 `product_not_enabled`.

## Making an order

- **By hand.** **New order** takes the entity, vendor, date, currency, how it is matched, and one line: an item code or
  description, a quantity, a unit of measure and a unit price. More lines go through `finance_po_create` or
  `POST /api/v1/finance/purchase-orders`.
- **From a document.** A Capture document read as a `purchase_order` becomes a draft with **From a document**: its date,
  currency and lines are filled in, and the vendor is matched by name.

Quantities are exact decimals (up to 6 places, like `2.5`), never rounded. A line's amount is its quantity times its unit
price; give one and it must agree. **Match** is **three-way** for goods (bills are checked against what was received) or
**two-way** for services (against what was ordered).

## Approval and the number

**Send for approval** sends a draft through the [approvals engine](/docs/finance/approvals.md) as document type `purchase_order`. With
no approval policy for it, a controller of its entity approves (never the person who sent it). Once approved the order
is **issued** and numbered `PO-000001`, gapless per entity, and its amount is **committed** against every budget its lines
touch ([policies and budgets](/docs/finance/policies-and-budgets.md)). A rejected order goes back to draft.

## Receiving

**Receive** records what arrived on an issued order: a quantity per line. Receipts are numbered `GR-000001` per entity.
Receiving more than a line ordered, plus the quantity tolerance, is refused. The order becomes **partly received**, then
**received** when every line has what it ordered.

## Closing

**Close** ends an order with a reason: no more bills or receipts, and its budget commitments are released. A draft, or an
issued order nothing was received or billed on, is **cancelled** instead. An order in approval cannot be closed.

## The match

A bill names its order with `po_id` (same entity, vendor and currency; an issued, not closed order). When it is sent for
approval, each bill line is paired with an order line: the one it names (`po_line_id`), else by item code, else by
words in common, the closer price breaking ties. Then, per line, the first of these that fails is its result:

| Result | When |
|---|---|
| `not_received` | Three-way and nothing received on the line yet |
| `quantity_variance` | This bill and earlier bills come to more than received (three-way) or ordered (two-way), plus the quantity tolerance. A line with no quantity is compared by amount, and counts as the quantity its amount buys at the order's price (to six decimal places, a half rounded to even, the same in the match and in what the order shows as billed), so a later line by quantity cannot bill those units again |
| `price_variance` | Its unit price is above the order's, plus the price tolerance |
| `not_ordered` | It pairs with no line of the order |
| `matched` | Otherwise |

A line is three-way when the order is, or when its line has receipts. With an absolute limit set, the matched lines may
come to at most that much over the order's prices; past it the bill gets `price_variance`. Under the order is never an
exception. Each result other than `matched` raises an exception of that kind (see [Finance bills](/docs/finance/bills.md) → Checks).

A bill in another currency, or a line in another unit of measure than its order line (`kg` against `each`), is refused:
it cannot be compared. `pcs`, `ea` and `unit` count as `each`.

Earlier bills count: a bill takes its quantities from the order line when it goes for approval, under a lock on the order,
so two bills sent at once cannot both take the last units. A voided or rejected bill gives them back.

## Tolerances

**Match tolerances** (controllers) are per entity, with an organisation default; without either: 5% on price, nothing on
quantity, no absolute limit, warn.

| Setting | Meaning |
|---|---|
| Price (`price_bps`) | How far above the order's unit price a bill may be, in basis points (500 is 5%) |
| Quantity (`quantity_bps`) | How far above received or ordered, and how much over-receipt is allowed |
| Total (`total_minor`) | The most the bill's matched lines may come to over the order, in minor units; empty is no limit |
| Outside them | **Warn**: the bill goes to approval flagged `over_po`, which an approval policy can route to a stricter chain. **Block**: it is refused, and the exceptions stay |

A bill 6% over its order with a 5% price tolerance raises `price_variance` and is flagged `over_po`.

## Open commitments

**Open** lists the issued orders not closed, and the open commitment per currency: what was ordered and not yet billed.
`finance_po_list` with `open: true` returns the same report.

## Who can do what

| Action | Roles |
|---|---|
| See orders, receipts and tolerances (`po.read`) | `ap_clerk`, `controller`, `auditor` |
| Create, change, send, close (`po.write`) | `ap_clerk`, `controller` |
| Receive (`receipts.create`) | `ap_clerk`, `controller` |
| Set tolerances (`policies.write`) | `controller` |

Rights are per entity: see [Finance roles](/docs/finance/roles.md). For an agent, creating and changing an order are drafts.

## Tools and API

| Tool | REST | What it does |
|---|---|---|
| `finance_po_list` | `GET /api/v1/finance/purchase-orders` | Orders, newest first; filter by status, entity, vendor, number; `open` adds the commitments |
| `finance_po_get` | `GET /api/v1/finance/purchase-orders/{id}` | One order with its lines (ordered, received, billed) and receipts |
| `finance_po_create` | `POST /api/v1/finance/purchase-orders` | A draft order, or one from a document (`document_id`) |
| `finance_po_update` | `PATCH /api/v1/finance/purchase-orders/{id}` | Change a draft |
| `finance_po_issue` | `POST /api/v1/finance/purchase-orders/{id}/issue` | Send it for approval |
| `finance_po_close` | `POST /api/v1/finance/purchase-orders/{id}/close` | Close or cancel it with a reason |
| `finance_receipt_create` | `POST /api/v1/finance/purchase-orders/{po_id}/receipts` | Record goods received |
| `finance_receipt_list` | `GET /api/v1/finance/purchase-orders/{po_id}/receipts` | An order's receipts |
| `finance_matchtolerance_get` | `GET /api/v1/finance/match-tolerances` | An entity's tolerances |
| `finance_matchtolerance_set` | `PUT /api/v1/finance/match-tolerances` | Set an entity's tolerances, or the default (`entity_id: null`) |

Every change is on the [audit trail](/docs/finance/audit-trail.md): orders under subject kind `purchase_order` (`finance.po.created`,
`.updated`, `.submitted`, `.issued`, `.rejected`, `.received`, `.closed`, `.cancelled`), receipts under `goods_receipt`
(`finance.receipt.created`) and tolerances under `match_tolerance` (`finance.match_tolerance.set`).
Orders can be mentioned in the workspace as `fin_po` ([Finance references](/docs/finance/references.md)).

Not yet: sending the order to the vendor as a PDF by email, and turning commitments into actuals when a bill is approved
(a closed order releases what is left).
