Cancel invoice

View as Markdown
## Cancel invoice Cancels the invoice `:id`, moving it to the `Expired` status so it can no longer be paid. This replaces the deprecated `PATCH /v1/invoice/:id/cancel`. ### Auth `x-api-key` header with **`Merchant.invoice.patch`**. Also accepts JWT user and POS JWT. ### Path params - `id` (required): the invoice id. ### Errors - **403** `Only invoices with a "New" status can be cancelled.` — the invoice is already paid, expired or invalid. ### Side effects Sets the status to `Expired`, records a `CANCELLED` invoice event (`{ reason: 'manual' }`, actor `API_USER`) and broadcasts the change over the websocket gateway. There is **no request body**; the response is `{ status: "cancelled" }`. --- **Notas:** Handler: invoiceCreationService.cancel. Cancelling maps to the Expired status, not to a dedicated "cancelled" status. Complements POST /v1/invoice/:id/reopen.

Authentication

x-api-keystring
API Key authentication via header

Path parameters

idstringRequired
Id of the New invoice to cancel.

Headers

x-application-account-idstringOptional

Scope the request to a specific store / account instead of the one resolved from the API key. Aliases: the x-account-id header, or the application_account_id / account_id query parameter.