Invoices
Set an invoice paid date
POST
/a/Invoice_setPaidDate
Write a non-empty paid-date string to an active Paid invoice.
When to use this endpoint
Use only for the legacy manual paid-date control after the invoice is marked Paid. It does not record a payment or change status.
Authentication and permissions
The request must use a logged-in CRM session or valid signed API credentials and is scoped to that tenant.
Users whose legacy crm_access mask contains bit 64 receive {"error":"no permission to access api"}. No record-owner check is made.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer | Yes | Active Paid invoice ID. |
val | Non-empty string | Yes | Passed through HTML escaping and stored without date parsing. |
Example request
$result = FM_api('Invoice_setPaidDate', ['id' => 981, 'val' => '2026-10-02']);
Example response
{
"ok": 1
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"invalid invoice date content"} | The supplied value is empty after escaping. |
{"error":"invoice does not exist"} | The invoice is absent or deleted. |
{"error":"cannot set paid date unless invoice is marked Paid"} | The active invoice is not Paid. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The value is not parsed as a date. The endpoint does not adjust
paid, change status, or create an invoice-payment row.
Side effects
- Updates
paid_dateand invoice edit metadata and firesInvoice_edit.
See it in Fieldmotion
CRM1
The main invoice page calls this route from the paid-date control.
CRM2
No direct production CRM2 caller was found for this route.
Related endpoints
Invoices_getDataTablesupplies paginated CRM2 invoice rows and IDs.Invoices_getDTis the CRM1 invoice-list counterpart.