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:
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. |
Updated 8 days ago