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

# Void

> Cancel a pre-authorization before it is captured.

A void cancels a pre-authorization and releases the hold on the customer's funds. Use this endpoint when you need to cancel a reservation before calling [capture](/docs/api-reference/payments/capture).

<Warning>
  You can only void a pre-authorization. To reverse a completed sale or capture, use the [refund](/docs/api-reference/payments/refund) endpoint instead.
</Warning>

<Note>
  Safe retries for this POST endpoint use the `Idempotency-Key` header. Reuse the same key only when retrying the exact same request body. See [Idempotency](/docs/api-reference/idempotency).
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://terminal.smartretry.com/v1/payments/void/ABC123 \
    --header 'x-api-key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --header 'Idempotency-Key: void-20260331-001' \
    --data '{
      "transaction_reference_id": "TX8A3F2C",
      "order_reference_id": "OR7B9E1D"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://terminal.smartretry.com/v1/payments/void/ABC123",
      headers={
          "x-api-key": "YOUR_API_KEY",
          "Content-Type": "application/json",
          "Idempotency-Key": "void-20260331-001"
      },
      json={
          "transaction_reference_id": "TX8A3F2C",
          "order_reference_id": "OR7B9E1D"
      }
  )

  print(response.json())
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://terminal.smartretry.com/v1/payments/void/ABC123",
    {
      method: "POST",
      headers: {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
        "Idempotency-Key": "void-20260331-001"
      },
      body: JSON.stringify({
        transaction_reference_id: "TX8A3F2C",
        order_reference_id: "OR7B9E1D"
      })
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "transaction_id": "TX5F1K2L",
    "order_id": "OR7B9E1D",
    "accepted": true
  }
  ```

  ```json 400 theme={null}
  {
    "type": "https://terminal.smartretry.com/errors/validation",
    "title": "Bad Request",
    "status": 400,
    "detail": "transaction has already been captured and cannot be voided",
    "reason_code": "TRANSACTION_ALREADY_CAPTURED"
  }
  ```
</ResponseExample>

## Path parameters

<ParamField path="terminal_friendly_id" type="string" required>
  Your terminal identifier. Exactly 6 characters.
</ParamField>

## Request body

<ParamField body="transaction_reference_id" type="string" required>
  The `transaction_id` of the pre-authorization to void. Exactly 8 characters.
</ParamField>

<ParamField body="order_reference_id" type="string" required>
  The `order_id` associated with the pre-authorization. Exactly 8 characters.
</ParamField>

## Response

<ResponseField name="transaction_id" type="string" required>
  SmartRetry's unique identifier for this void transaction. Exactly 8 characters.
</ResponseField>

<ResponseField name="order_id" type="string">
  The order identifier, matching the `order_id` from the original pre-authorization.
</ResponseField>

<ResponseField name="merchant_order_id" type="string">
  The `merchant_order_id` associated with the order, when present.
</ResponseField>

<ResponseField name="accepted" type="boolean" required>
  `true` if the void was accepted for processing. Poll the [status endpoint](/docs/api-reference/payments/status) using the returned `transaction_id` to confirm the void outcome.
</ResponseField>
