Assign Document Credit To Document
The AssignDocumentCreditToDocument
API is used to assign document credit to a specific document in OCS.io. This operation is crucial in managing the credit allocation among various documents in the system.
API Overview
Fields Required for Document Credit Assignment
The following table lists and describes the fields required to assign document credit to a document through the AssignDocumentCreditToDocument
API:
Field | Description |
---|---|
account |
ID (Ref ID/ External ID ) of the Account. |
sourceDocumentRefId |
ID (Ref ID) of the source Document. |
targetDocumentRefId |
ID (Ref ID) of the target Document. |
amount |
Amount of the Assignment. |
currency |
Currency ISO Code of the Assignment. |
notificationRequested |
Indicates whether 'Credit assignment' Notification will be triggered. |
Detailed API documentation and endpoint specifics are available here. |
Request Validations
The following validations are performed when assigning document credit to a document:
-
Account must be provided in the request, it must be already created in the system and must not be in Deactivated State.
-
Payer must be already created in the system.
-
Currency must be configured in the system.
-
Document Credit (Source Document) provided in the request, must exist in the system.
-
Document Credit (Source Document) provided in the request, must not be Cancelled.
-
Document (Target Document) provided in the request, must exist in the system.
-
Document (Target Document) provided in the request, must not be Cancelled.
-
Currency of the Document Credit must be identical with Currency of the Document.
-
Transaction Amount must not exceed Remaining Amount of the Document Credit.
-
Transaction Amount must not exceed Due Amount of the Document.
Assign Document Credit to Document Example
Use the following request’s body to assign document credit to a document:
{
"requestId": "{{$guid}}",
"user": "crm",
"account": {
"externalId": "account_external_id"
},
"sourceDocumentRefId": "source_document_id",
"targetDocumentRefId": "target_document_id",
"amount": 100,
"currency": "EUR"
}
The outcome of the API call is as follows:
-
It is validated, that Source Document and Target Document must belong to the same account with External ID
account_external_id
-
Document credit from the document with reference ID
source_document_id
is assigned to the document with reference IDtarget_document_id
-
The amount of the assignment is
100
and the currency isEUR