issue_ar_invoice
Issue a draft — this is the booking step (accountant role).
In one transaction it assigns the next invoice number, posts the journal entry
(debit the AR control account, credit revenue per line, credit output VAT per VAT
code), opens the receivable open item the customer's payment will settle, freezes
the invoice against further edits (status → issued) and renders the PDF+QR
snapshot. The turnover reaches the VAT return from here — a draft never does.
Only a draft can be issued: re-issuing an issued invoice is a 409. It is also
refused when the invoice is not ready (no customer, no lines, a line without a
revenue account…) — call GET …/ar/invoices/{invoice_id}/readiness first, whose
blocking list is exactly what this refuses on — when the issue_date is not
inside an open accounting period, or when the fiscal year has no AR control
account configured.
Returns the issued invoice (now with document_no and
commercial_document_id). A renderer outage does not fail the issue: the booking
stands and the snapshot stays pending, re-rendered on demand by
GET …/ar/invoices/{invoice_id}/pdf. To undo one, reverse its journal entry; there
is no un-issue.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company_id | Yes | ||
| invoice_id | Yes |