---
title: "Match a bank deposit to the invoice (marks fully paid)"
method: POST
path: "/companies/{companyId}/ar/{id}/match-transaction"
tags: ["AR/AP"]
---

# Match a bank deposit to the invoice (marks fully paid)

`POST /companies/{companyId}/ar/{id}/match-transaction`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/companies/{companyId}/ar/{id}/match-transaction`
- Auth: HTTP bearer

DARK — 404s unless ar_ap_items_enabled. Body {transactionId}. The transaction must belong to the company (company-scoped lookup; a cross-tenant id is a 404). Writes an ar_item_payments row for the item's OUTSTANDING amount (paid_at = the transaction's occurred_on), bumps amountPaidCents to the total, and transitions to 'paid' through the FSM — the Stripe-source lock and legal-transition guards hold exactly as for the drawer actions.

## Request body

- object
  - `transactionId` string, uuid, required

## Response `200`

Invoice marked paid (item with availableTransitions)

## Other responses

- `404`: Item or transaction not found, or AR/AP not enabled
- `409`: Stripe-source item is status-locked
- `422`: Already fully paid or illegal transition (e.g. draft)

---

[API](https://skmtc.dev/medianfi/apis/median-api.md) · [All operations](https://skmtc.dev/medianfi/apis/median-api/llms.txt) · [OpenAPI document](https://skmtc.dev/medianfi/apis/median-api/revisions/20090ea32b0d?raw)
