The Void and Cancel requests both reverse a transaction, but their use depends critically on the original transaction’s status. Both operations use the same request structure but differ in their RequestType.
Settled TransactionsIf the transaction has already been captured and the settlement batch is closed (e.g., it’s the next day), a Void is not possible. You must use a Refund request instead.
Request
The Refund request uses the same endpoint as the initial/charge-token request. The API determines it’s a settlement based on the RequestType value within the BasicInfo object.
See the example below:
RequestType is set to the value corresponding to a Refund (e.g., 3). The Amount specifies the refund amount (which can be less than the original capture amount for a partial refund).
Request Parameters
The following table highlights the critical fields used to define a Refund request:| Parameter | Type | Description |
|---|---|---|
RequestType | Int32 | 4 for Cancel ot 5 for Void. |
Amount | Decimal | Must be the full amount of the original authorization/sale. |
MerchantRequestId | String | A new, unique ID for this specific reversal attempt. |
TransactionId | String | The unique Nayax ID returned in the original response. |
TransactionTimeUtc | DateTime | The UTC timestamp of the original transaction. |
ValidationKey | String | Cryptographic key to authenticate this specific reversal request. |
Response
A successful validation returns a200 OK status and a body containing the validated merchant details:
Response Parameters
The table below describes the parameters of the response:| Parameter | Type | Description |
|---|---|---|
verdict | String | Approved or Declined. The final decision. |
code | Int32 | Response code: 0 for approved otherwise, the relevant decline code. |
statusMessage | String | A descriptive message about the transaction outcome. |
amount | Decimal | The transaction amount processed. |
currency | String | The currency of the transaction. |
merchantRequestId | String | The unique ID from the original request. |
transactionId | String | The unique transaction ID assigned by the Nayax system. |
transactionTimeUtc | DateTime | The UTC timestamp when the transaction was completed. |
nayaxTokenId | String | The token ID used for the charge. |
siteId | Int32 | The site ID associated with the payment. |
providerTransactionId | String | The unique ID assigned by the Payment Service Provider (PSP). |
decimalPlace | Int32 | The number of decimal places used for the currency/amount. |