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

# CancelTransaction

The /CancelTransaction endpoint is a POST request that allows you to
cancel a transaction currently in progress. This method is referred to
as "Cancel" in the Pre-Authorization flow and "Void" in the
Pre-Selection flow.


## OpenAPI

````yaml /openapi/spark.yaml post /CancelTransaction
openapi: 3.0.1
info:
  title: Nayax Spark API
  description: RemoteStart V2
  version: v2
servers:
  - url: https://{domain}/api
    variables:
      domain:
        default: nayax-spark-dmz.nayax.com
        description: >-
          Your Nayax-assigned domain (e.g., nayax-spark-dmz.nayax.com). Nayax
          provides a QA domain during sandbox onboarding and a production domain
          after certification.
security: []
tags:
  - name: Transactions
paths:
  /CancelTransaction:
    post:
      tags:
        - Transactions
      summary: CancelTransaction
      requestBody:
        description: The request to cancel a transaction.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelTransactionRequest'
      responses:
        '200':
          description: Success. The transaction has been successfully canceled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelTransactionResponse'
components:
  schemas:
    CancelTransactionRequest:
      type: object
      nullable: true
      description: >-
        The request body for canceling a transaction. This is used to cancel a
        pre-authorized transaction or void a pre-selected one, providing details
        such as the transaction ID, the reason for cancellation, and the amount.
      properties:
        NayaxTransactionId:
          type: integer
          format: int64
          nullable: false
          description: >-
            The unique transaction ID assigned by Nayax, provided in the
            `/TransactionCallback`.
        SparkTransactionId:
          type: string
          nullable: false
          description: >-
            The unique session ID from the initial `/StartAuthentication`
            request.
        SiteId:
          type: integer
          format: int16
          nullable: false
          description: The ID of the site where the transaction occurred.
        MachineAuTime:
          type: string
          nullable: false
          description: >-
            The timestamp of the cancellation from the device in its local
            timezone. The format is `yyyyMMddHHmmssSSS`.
        TerminalId:
          type: string
          nullable: false
          description: The serial or external ID of the terminal used.
          maxLength: 255
        TerminalIdType:
          type: integer
          format: int32
          nullable: false
          description: >-
            Defines the type of ID used for the `TerminalId` parameter. Use `1`
            for the HW Serial or `2` for the Nayax Machine ID.
        CancellationType:
          type: integer
          format: int32
          nullable: false
          description: >-
            Indicates which cancellation flow is being implemented. Use `1` for
            a Pre-Authorization Cancel or `2` for a Pre-Selection Void.
        ReasonCode:
          type: integer
          format: int16
          nullable: false
          description: The internal code explaining the reason for the cancellation.
        ReasonText:
          type: string
          nullable: true
          description: >-
            A human-readable explanation of the cancellation reason. This
            parameter is optional.
        CancelAmount:
          type: number
          format: double
          nullable: false
          description: >-
            The amount to be canceled in major currency units (e.g., dollars or
            euros).
    CancelTransactionResponse:
      type: object
      nullable: true
      description: >-
        The response object for a canceled transaction, confirming the outcome
        of the cancellation and providing key details such as transaction
        identifiers, timestamps, and payment information.
      properties:
        SparkTransactionId:
          type: string
          nullable: true
          description: The ID of the canceled session.
        Status:
          type: object
          description: >-
            An object containing the final verdict of the cancellation and a
            descriptive message.
          properties:
            Verdict:
              type: string
              description: >-
                The outcome of the cancellation. It will be `"Approved"` if
                successful or `"Declined"` if it failed.
            ErrorDescription:
              type: string
              description: >-
                Provides additional information if the verdict is `"Declined"`,
                or `"No Errors"` for a successful request.
            ErrorCode:
              type: number
              description: >-
                A numeric code that specifies the type of error that occurred.
                This field is present only in error responses.
        CardBrand:
          type: string
          nullable: true
          description: >-
            The brand of the card used for the transaction (e.g., `"Visa"`,
            `"MasterCard"`).
        CardLast4Digits:
          type: string
          nullable: true
          description: The last four digits of the card used.
        AuthCode:
          type: string
          nullable: true
          description: The authorization code for the cancellation.
        MachineAuTime:
          type: string
          nullable: true
          description: >-
            The timestamp of the cancellation from the device, in the format
            `yyyyMMddHHmmssSSS`.
        AuTime:
          type: string
          nullable: true
          description: The timestamp from the authorization server.
        CancelTime:
          type: string
          nullable: true
          description: >-
            The server timestamp of the cancellation confirmation, in the format
            `yyyyMMddHHmmssSSS`.
        CurrencyCode:
          type: string
          nullable: true
          description: The ISO currency code (e.g., `"EUR"`).
        CurrencyNumeric:
          type: string
          nullable: true
          description: The ISO numeric currency code (e.g., `"978"` for EUR).
        FiscalRrn:
          type: string
          nullable: true
          description: The fiscal reference number for the receipt or audit trail.
        NayaxRRN:
          type: string
          nullable: true
          description: The Nayax reference number of the transaction.

````