Pay Document On-Line

The PayDocumentOnline API is used to register online payments for documents in OCS.io. This API is particularly useful when there’s a need to record online payments made for documents.

API Overview

Fields Required for Online Document Payment

The following table lists and describes the fields required to register an online payment for a document through the PayDocumentOnline API:

Field Description

account

ID (Ref ID/ External ID ) of the Account.

documentRefId

ID (Ref ID) of the Document. Either 'documentRefId', 'documentNo' or 'externalDocumentNo' must be populated.

documentNo

Number of the document (generated by RM module). Either 'documentRefId', 'documentNo' or 'externalDocumentNo' must be populated.

externalDocumentNo

External number of the document (generated by external system, e.g. OCS or CRM). Either 'documentRefId', 'documentNo' or 'externalDocumentNo' must be populated.

paymentAmount

Amount of the Payment.

currency

Currency ISO Code.

paymentDatePerformed

Date/Time when OnLine Payment was performed.

paymentRef

Payment Reference No.1 associated with the Payment.

paymentRef2

Payment Reference No.2 associated with the Payment.

paymentRef3

Payment Reference No.3 associated with the Payment.

channelType

Type of channel (e.g. card, bank transfer, etc.).

Detailed API documentation and endpoint specifics are available here.

Request Validations

The following validations are performed when registering an online payment for 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 provided in the request, must exist in the system.

  • Document provided in the request, must not be Cancelled.

  • Document provided in the request, must belong to the same Account.

  • Currency provided in the request must be identical with Currency of the Document.

Register Online Payment for Document Example

Use the following request’s body to register an online payment for a document:

{
  "requestId": "{{$guid}}",
  "user": "crm",
  "account": {
    "externalId": "account_external_id"
  },
  "documentRefId": "document_reference_id",
  "paymentAmount": 100,
  "currency": "EUR",
  "paymentDatePerformed": "2024-05-01T00:00:00+02:00",
  "paymentRef": "payment_reference_1",
  "paymentRef2": "payment_reference_2",
  "paymentRef3": "payment_reference_3",
  "channelType": "card"
}

The outcome of the API call is as follows:

  • An online payment for the document with reference ID document_reference_id is registered

  • The payment amount is 100 and the currency is EUR

  • The payment was performed on 2022-01-01T00:00:00Z

  • The payment references are payment_reference_1, payment_reference_2, and payment_reference_3

  • The channel type is card