CancelTransaction

The CancelTransaction endpoint allows you to cancel a transaction that is in progress.

In the Pre-Authorization flow, this method is referred to as "Cancel," and in the Pre-Selection flow, it is referred to as "Void."

Request

Send a POST request to Spark/spark/CancelTransaction endpoint with the following body:

{
  "NayaxTransactionId": 2004545072,
  "SparkTransactionId": "12c7cec2-c690-4425-9a1f-db0db60e2d8c",
  "SiteId": 2,
  "MachineAuTime": "20240205194122328",
  "TerminalId": "0434334921100366",
  "TerminalIdType": 1,
  "CancellationType": 1,
  "CancelAmount": 15.00,
  "ReasonCode": 101,
  "ReasonText": "User aborted session"
}

Request Parameters

The table below describes the parameters of the request:

Field

Type

Required

Description

NayaxTransactionId

Integer

Yes

Unique transaction ID assigned by Nayax provided in /TransactionCallback.

SparkTransactionId

String

Yes

The session ID from the initial./StartAuthentication

SiteId

Integer

Yes

ID of the site where the transaction occurred

MachineAuTime

String

Yes

Timestamp of cancellation from the device in its timezone (format: yyyyMMddHHmmssSSS).

TerminalId

String

Yes

Serial or external ID of the terminal used

TerminalIdType

Integer

Yes

Defines the ID type used.
1 for HW Serial,
2 for Nayax Machine ID.

CancellationType

Integer

Yes

Indicates which cancellation flow is implemented:
1 for a Pre-Authorization Cancel.
2 for a Pre-Selection Void.

CancelAmount

Float

Yes

Amount to cancel in major currency unit (e.g., dollars, euros)

ReasonCode

Integer

Yes

Internal code explaining the reason for cancellation

ReasonText

String

No

Human-readable explanation of the cancellation reason

Response

A successful response will return the following body:

{
  "SparkTransactionId": "12c7cec2-c690-4425-9a1f-db0db60e2d8c",
  "Status": {
    "Verdict": "Approved",
    "ErrorDescription": "No Errors"
  },
  "CardBrand": "Visa",
  "CardLast4Digits": "1234",
  "AuthCode": "333333",
  "MachineAuTime": "20240205194122328",
  "AuTime": "20240205174122328",
  "CancelTime": "20240205192215572",
  "CurrencyCode": "EUR",
  "CurrencyNumeric": "978",
  "FiscalRrn": "1A2b3C4d5E6f7g8H9i",
  "NayaxRRN": "111111"
}

Response Parameters

The table below describes the parameters of the response:

FieldTypeDescription
SparkTransactionIdStringID of the canceled session.
StatusObjectStatus object including result and error description.
Status.VerdictString"Approved" if successfully canceled, "Declined" if failed.
Status.ErrorDescriptionStringFurther info ifDeclined, or "No Errors" if success.
Status.ErrorCodeNumberA numeric code indicating a specific type of error that occurred during the transaction. This field is present only in error responses.
CardBrandStringCard brand used for the transaction (e.g., Visa, MasterCard).
CardLast4DigitsStringThe last four digits of the card used.
AuthCodeStringAuthorization code for the cancellation.
MachineAuTimeStringTimestamp of cancellation from the device in its timezone (format: yyyyMMddHHmmssSSS).
AuTimeStringAuthorization server timestamp.
CancelTimeStringServer timestamp of the cancellation confirmation (format: yyyyMMddHHmmssSSS).
CurrencyCodeStringISO currency code (e.g., "EUR").
CurrencyNumericStringISO numeric currency code (e.g., "978" for EUR).
FiscalRrnStringFiscal reference number (for receipt/audit trail).
NayaxRRNStringNayax reference number of the transaction.