Skip to main content

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/json
    • accessToken: Required. This is your access token for authenticating the request.

Path Parameters

ParameterTypeDescription
idStringThe 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:

FieldTypeDescription
nameStringThe updated name of the payment term.
statusBooleanThe updated status indicating if the payment term is active.
dueTypeStringThe updated condition upon which the payment is due. Must be either net or fulfillment.
paymentDueDaysNumberRequired 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

KeyTypeDescription
successBooleanIndicates if the request was successful.
dataObjectContains the details of the updated payment term.
createdAtStringTimestamp of when the payment term was originally created (ISO 8601 format).
updatedAtStringTimestamp of when the payment term was last updated (ISO 8601 format).
idStringThe unique identifier of the payment term.

Notes

  • Ensure that the accessToken provided is valid and has not expired.
  • Replace {id} in the URL with the actual ID of the payment term you wish to update.