-
-
Notifications
You must be signed in to change notification settings - Fork 0
Invoices
nejcc edited this page Jul 7, 2026
·
1 revision
invoices() maps to issuedinvoices and adds three helpers on top of
CRUD. Minimax invoices are created in a draft state, then
issued — a state-changing action guarded by the record's RowVersion
(optimistic concurrency).
| Method | Description |
|---|---|
action($id, $action, $rowVersion) |
Run any invoice action (e.g. "Issue", "IssueAndGeneratePdf"). |
issue($id, $rowVersion) |
Issue the invoice and generate its PDF in one call. Returns the invoice payload. |
pdf($id, $rowVersion) |
Issue and return the raw (base64-decoded) PDF bytes. |
// 1. Create a draft invoice
$invoice = Minimax::invoices()->create([
'CustomerId' => 1,
'DateIssued' => now()->toDateString(),
'InvoiceRows' => [
['ItemId' => 77, 'Quantity' => 1, 'Price' => 50.00, 'VatRateId' => 1],
],
]);
// 2. Issue it and stream the PDF to the browser
$bytes = Minimax::invoices()->pdf($invoice['IssuedInvoiceId'], $invoice['RowVersion']);
return response($bytes, 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="invoice.pdf"',
]);Always pass the current RowVersion. It comes back from create() / find()
and guards against issuing a stale invoice — a mismatch is rejected by the API.
Minimax SDK