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:
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:Response Parameters
The table below describes the parameters of the response:| Field | Type | Description |
|---|---|---|
SparkTransactionId | String | ID of the canceled session. |
Status | Object | Status object including result and error description. |
Status.Verdict | String | ”Approved” if successfully canceled, “Declined” if failed. |
Status.ErrorDescription | String | Further info ifDeclined, or "No Errors" if success. |
Status.ErrorCode | Number | A numeric code indicating a specific type of error that occurred during the transaction. This field is present only in error responses. |
CardBrand | String | Card brand used for the transaction (e.g., Visa, MasterCard). |
CardLast4Digits | String | The last four digits of the card used. |
AuthCode | String | Authorization code for the cancellation. |
MachineAuTime | String | Timestamp of cancellation from the device in its timezone (format: yyyyMMddHHmmssSSS). |
AuTime | String | Authorization server timestamp. |
CancelTime | String | Server timestamp of the cancellation confirmation (format: yyyyMMddHHmmssSSS). |
CurrencyCode | String | ISO currency code (e.g., “EUR”). |
CurrencyNumeric | String | ISO numeric currency code (e.g., “978” for EUR). |
FiscalRrn | String | Fiscal reference number (for receipt/audit trail). |
NayaxRRN | String | Nayax reference number of the transaction. |