> ## Documentation Index
> Fetch the complete documentation index at: https://devzone.nayax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Void or Cancel

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.

> [!NOTE]
>
> **Settled Transactions**
>
> If 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 Void or Cancel request uses the same endpoint as the initial [`/close-transaction`](https://devzone.nayax.com/reference/ecom/payments/close-transaction) request. The API determines it's a void or cancel based on the `RequestType` value within the `BasicInfo` object.

See the example below:

```json theme={null}
{
  "basicInfo": {
    "requestType": 3,          // 3 for Void, 7 for Cancel
    "entryMode": 1,
    "amount": 25.00,           // The full amount of the original transaction
    "currency": "EUR",
    "countryCode": "DE",
    "tokenModel": 1,
    "cvc": null,
    "token": null,
    "merchantRequestId": "NEW_CANCEL_VOID_ID_003", // New unique ID for this reversal request
    "transactionId": "ORIGINAL_NAYAX_TRX_98765", // ID of the original transaction being reversed
    "transactionTimeUtc": "2025-08-28T10:30:00Z", // Time of the original transaction
    "isSaveTokenWithoutConsent": false
  },
  "machineInfo": {
    "machineId": "0434334921100366"
  },
  "cardHolderInfo": {},
  "paymentInfo": {},
  "additionalInfo": {},
  "validationKey": "AUTH_VALID_KEY_XYZ_REVERSAL"
}
```

Note that the `RequestType` is set to the value corresponding to a Void (3) or Cancel (7). The `Amount` specifies the full amount of the original authorization/sale.

### Request Parameters

The following table highlights the critical fields used to define a Void or Cancel request:

| Parameter | Type | Description |
| :- | :- | :- |
| `RequestType` | Int32 | The request type can be 3 for `Void`, 7 for `Cancel`. |
| `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 a `200 OK` status and a body containing the validated merchant details:

```json theme={null}
{
  "status": {
    "verdict": "Approved",
    "code": 0,
    "statusMessage": "Payment processed successfully."
  },
  "basicInfo": {
    "amount": 25.5,
    "currency": "EUR",
    "merchantRequestId": "MERCHANT_MIT_001",
    "transactionId": "NAYAXTRANS98765",
    "transactionTimeUtc": "2025-08-28T10:30:00Z"
  },
  "paymentInfo": {
    "amount": 25.5,
    "currency": "EUR",
    "nayaxTokenId": "NAYAXTOK12345",
    "siteId": 1,
    "providerTransactionId": "PSP_TRANS_ABC",
    "decimalPlace": 2
  }
}
```

### 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. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.