Customers
Set customer credit terms
/a/Customer_setCreditTerms
Replace or clear the free-text credit terms stored on one customer.
When to use this endpoint
Use Customer_setCreditTerms when a customer-specific billing workflow needs to maintain the CRM credit-terms text.
The endpoint does not interpret the value as days or synchronize it to an accounting platform; callers agree the meaning of the text themselves.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.
The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Customer to update; it must convert to a positive integer. |
value | String | No | New credit terms, trimmed and limited to 255 bytes. Omission and blank both clear the field. The parameter name is value, not val. |
Example request
$result = FM_api('Customer_setCreditTerms', [
'id' => '1088',
'value' => '30 days from invoice date',
]);
Example response
{
"ok": 1
}
An unchanged trimmed value returns {"ok":1,"msg":"no change needed"}.
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":"missing or invalid parameter: id"} | id is absent or invalid. |
{"error":"max length of value is 255"} | The trimmed value exceeds 255 bytes. |
{"error":"customer does not exist"} | No matching customer row exists. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Omitting
valueis a destructive clear, not a no-op. - The lookup does not filter by active or deleted state.
- The limit uses PHP
strlen, so it counts bytes rather than Unicode characters. - This is a single-record mutation; it provides no list filtering or pagination.
Side effects
- A real change updates
credit_terms,last_edited, andedited_uuid, and invalidates the customer cache. - It writes a customer audit-log entry and fires
Customer_edit.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found. Use a signed request if this focused setter is required.
CRM2
No direct production CRM2 caller was found; its customer forms use the mapped layout update contract.
Related endpoints
Customer_getretrieves the stored terms.Customers_getByIdsupports retrieving selected fields for known customer IDs.