Update Payment Term
This API endpoint allows you to update an existing payment term based on the provided ID.
HTTP Request
- URL:
/api/paymentTerms/{id} - Method:
PUT - Headers:
Content-Type:application/jsonaccessToken: Required. This is your access token for authenticating the request.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | The unique identifier of the payment term to update. |
Request Body
The request body should be a JSON object that may include any of the following fields to update:
| Field | Type | Description |
|---|---|---|
name | String | The updated name of the payment term. |
status | Boolean | The updated status indicating if the payment term is active. |
dueType | String | The updated condition upon which the payment is due. Must be either net or fulfillment. |
paymentDueDays | Number | Required if dueType is net; specifies the updated number of days after the due type upon which payment is due. Optional if dueType is fulfillment. |
Sample Payload
{
"name": "Net 180",
"status": true,
"dueType": "net",
"paymentDueDays": 180
}
cURL Example
Below is a sample cURL command demonstrating how to make a request to the API endpoint:
curl --location --request PUT '/api/paymentTerms/67a46366869ddc960b432623' \
--header 'Content-Type: application/json' \
--header 'accessToken: <ACCESS_TOKEN>' \
--data '{
"name": "Net 180",
"status": true,
"dueType": "net",
"paymentDueDays": 180
}'
Response
- 200 OK: The payment term was successfully updated, and the server returned the updated details.
- 4XX: Client errors indicating issues such as validation errors or resource not found.
- 5XX: Server errors indicating that something went wrong on the server's end.
Sample JSON Response
Below is an example of the JSON response you might receive after successfully updating a payment term:
{
"success": true,
"data": {
"name": "Net 180",
"status": true,
"dueType": "net",
"paymentDueDays": 180,
"createdAt": "2025-02-06T07:23:18.394Z",
"updatedAt": "2025-02-06T07:29:38.846Z",
"id": "67a46366869ddc960b432623"
}
}
Response Details
| Key | Type | Description |
|---|---|---|
success | Boolean | Indicates if the request was successful. |
data | Object | Contains the details of the updated payment term. |
createdAt | String | Timestamp of when the payment term was originally created (ISO 8601 format). |
updatedAt | String | Timestamp of when the payment term was last updated (ISO 8601 format). |
id | String | The unique identifier of the payment term. |
Notes
- Ensure that the
accessTokenprovided is valid and has not expired. - Replace
{id}in the URL with the actual ID of the payment term you wish to update.