Cancel Payment

The CancelPayment API is used to cancel payments in OCS.io. This API is particularly useful when there’s a need to record the cancellation of payments.

API Overview

Fields Required for Cancelling Payment

The following table lists and describes the fields required to cancel a payment through the CancelPayment API:

Field Description

account

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

paymentRefId

ID (Ref ID) of the Payment. Either 'PaymentRefId', 'PaymentNo' or 'externalPaymentNo' must be populated.

paymentNo

Number of the Payment (generated by RM module). Either 'PaymentRefId', 'PaymentNo' or 'externalPaymentNo' must be populated.

externalPaymentNo

External number of the Payment (generated by external system, e.g. OCS or CRM). Either 'PaymentRefId', 'PaymentNo' or 'externalPaymentNo' must be populated.

reason

Reason for Cancellation. Cancellation Reason must be configured.

Detailed API documentation and endpoint specifics are available here.

Request Validations

The following validations are performed when cancelling a payment:

Cancel Payment Example

Use the following request’s body to cancel a payment:

{
  "requestId": "{{$guid}}",
  "user": "crm",
  "account": {
    "externalId": "account_external_id"
  },
  "paymentRefId": "payment_ref_id",
  "paymentNo": "payment_no",
  "externalPaymentNo": "external_payment_no",
  "reason": "cancellation_reason"
}

The outcome of the API call is as follows:

  • The payment with reference ID payment_ref_id is cancelled.

  • The reason for cancellation is cancellation_reason.