Cancel Request
An overview of the Cancel Request message.
Overview
Please see below for information on configuring the Cancel Request, as well as the expected Cancel Response.
- txCancelRequest - originating from the application to initiate a request for a cancel transaction
- txCancelResponse - originating from the card terminal to return the response of a cancel request
The Cancel Request is used to Cancel (void) a payment - either partially or fully - which occurred within the current business day (until 22:00 GMT+2) or to refund a successful payment - either partially or fully - which occurred prior to the current business day (i.e. after the clearance process has taken place1)
1 Note: the clearance process also takes place on weekends and holidays
txCancelRequest
txCancelRequest executes a typical transaction cancellation or refund. The operation depends on whether the Sale transaction to be cancelled/refunded was made on the same day (cancellation) or any day before that (refund). Please note the parameters below and how they apply to different cancellation/refund scenarios further down.
msgLength | String | 4 | A 4-digit number padded with leading zeros indicating message length minus 4 (including any separators). The request will be rejected if the correct message length is not provided. | 0061 | ||
sessionId | String | 6 | A unique number to control integrity of session sequence. | 002690 | ||
msgType | String | 3 | 200 | 200 | ||
msgCode | String | 2 | 04 | 04 | ||
uniqueTxnId | String | 32 | A unique transaction ID transmitted to the host for storage with the transaction. Note that this value will be provided in the MerchantTrns field provided in the sales export response. | 12345678901234567890123456789012 | ||
amount | String | variable up to 13 | Amount always including 2 decimal digits following the decimal point. A dot must always be used as a decimal point. If the amount is less than the transaction's full amount and the transaction date is today, then an error is returned as only a void is possible and therefore a full amount must be given. In all other cases, the amount can be partial to enable partial refunds. If no amount is supplied, it is assumed that the transaction amount is to be returned. | 123.00 | ||
refNum | String | 6 | The STAN number of the transaction to be cancelled. Note that if the STAN value is unknown the application may provide the value ‘000000’. In that case, after card presentment, the terminal will provide a list of the last 3 transactions made with the presented card, allowing the user to select the transaction to be canceled. | 826987 | ||
sourceTerminalId | String | 8 | Optional The terminal ID of the source with which the transaction is associated. |
12345678 | ||
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Receipt_UID | String | 200 | The unique identifier (UID) is a numeric or alphanumeric string that is associated with a single entity within the cashier system. | 193302323D532594AD14B669BCCC60C74FCA8BB6 | 👉 Applicable only in Greece |
|
MARK | String | 0 | Unique ID provided by AADE. Commonly is null as this provided at the end of each successful transaction. | null | 👉 Applicable only in Greece |
|
SignatureDateTime | String | 200 | The Date and time of the Provider's Digital Signature. | 20240513134504 | 👉 Applicable only in Greece |
|
PaidAmount | String | 200 | The amount to be paid. This value should be the same as the amount parameter and should be specified without any special character, such as comma (,) or point (.) |
12400 | 👉 Applicable only in Greece |
|
AmountWithoutTax | String | 200 | The amount without TAX to be paid. This value should be specified without any special character, such as comma (,) or point (.) |
10000 | 👉 Applicable only in Greece |
|
VAT | String | 200 | The value of VAT percentage that applied to the total amount. This value should be specified without any special character, such as comma (,) or point (.) If different value of TAX applied to the items of the transaction, then should be specified in this parameter, the highest value of TAX. |
24 | 👉 Applicable only in Greece |
|
AmountWithTax | String | 200 | The amount with TAX to be paid. This value should be specified without any special character, such as comma (,) or point (.) |
12400 | 👉 Applicable only in Greece |
|
POSTerminalID | String | 200 | The POS ID through which the transaction will be handled. The value of POS ID is NOT be the Device Serial Number, and can be found through the Viva Softpos Application Settings. |
16000198 | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
ProviderID | String | 200 | The ID of the ΥΠΑΗΕΣ Provider that generates the Digital Signature for this transaction. To learn more about all licensed AADE providers, please visit this page. |
999 | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
aadeProviderSignature | String | 200 | The fields of providerSignatureFields encrypted using a public key and the Elliptic Curve Digital Signature Algorithm (ECDSA): The signature should be sent to POS in base64 format. |
MEUCIQDHGhz2KQ+gddCsryDxcF69wW3o7C5WpuULHJ8DPeuLBgIgVxgCbh+OFtuZCwAOp7O8kJ+ShPlcpw84RG2jLBAWp2c= | 👉 Applicable only in Greece |
|
Reserved | String | 0 | Empty | null | 👉 Applicable only in Greece |
|
txnDateFrom (NOT YET SUPPORTED) | String | 24 | Optional If supplied and no orderCode or refNum is given, then the returned transactions are within the txnDateFrom and txnDateTo bounds. If it is not supplied, then the last three transactions are returned as is the case with the current protocol. |
2021-03-18T14:42:53.341Z | ||
txnDateTo (NOT YET SUPPORTED) | String | 24 | Optional If supplied and no orderCode or refNum is given, then the returned transactions are within the txnDateFrom and txnDateTo bounds. If it is not supplied, then the last three transactions are returned as is the case with the current protocol. If a txnDateFrom is supplied and no txnDateTo is given, then the application assumes that txnDateTo is today's date. If a txnDateTo is supplied without a txnDateFrom, then an error must be returned. |
2021-03-20T14:42:53.341Z | ||
orderCode | String | 16 | Optional Can be provided instead of or together with a refNum number. If a txnDateFrom/txnDateTo is provided, then the returned transaction results are bound by these dates, otherwise the last three transactions are returned. |
1069120310000201 | ||
shortOrderCode | String | 10 | Optional Can be provided instead of or together with a refNum number. If a txnDateFrom/txnDateTo is provided, then the returned transaction results are bound by these dates, otherwise the last three transactions are returned. |
1069120310 | ||
protocol | String | 20 | The protocol used (for internal use only) | ecr_default |
The above information elements must be joined into one single string using ‘|’ as a separator.
A cancel/void/refund request without using AADE parameters looks as follows:
0061|002690|200|04|12345678901234567890123456789012|123.00|826987
A cancel/void/refund request using AADE parameters looks as follows:
1026|000202|200|04|7685000117R0117402600000324|3.24|074054||||||||08F794F8C73EE72E3A2DE10A90FCCD6E2D3DE628|0|20240917174032|324|287|37|324|16000198|||003|||MEUCIBlOLZlmK5WBMJ6emJdU4ta2CHijnGoxwJu3EezGQ+6BAiEAw1cTRDHzM4ZVTZmd3ZEK59xYxlw7n4XJwmpy43/2+Ac=||
If the resulting string gets appropriately transmitted to the terminal, the terminal will respond with a txResponse
message.
If only the amount is communicated during the refund and no order code is given:
- Show a list of transactions. Above the list show: Refund X EUR for which transaction?
- Each list item should contain the transaction ID, transaction date, original sale amount.
- Once a list item is chosen by the operator, show the refund confirmation (Are you sure you want to refund X EUR from the transaction with transaction ID A, transaction date B, original sale amount C?)
- Once confirmed, proceed with refund. No amount revalidation/entry necessary by terminal operator!
If the order code is communicated during the cancel/void/refund and no amount is given, then it is assumed that the entire amount is to be refunded:
- Proceed with refund. No amount revalidation/entry necessary by terminal operator!
If the order code is communicated during the refund and an amount is given:
- Proceed with refund. No revalidation/entry necessary by terminal operator!
Notes
msgLength
indicates the length of the message starting from the first separator. Since msgLength has always a length of 4, the value stored in msgLength is the total message length minus 4. The request will be rejected if the correct message length is not provided.uniqueTxnId
must be exactly 32 characters, so padding (even with space characters) is required.||
– for any optional parameters you do not want to use, the position should be empty.protocol
- this is for internal use only and can therefore be excluded from your requests
txCancelResponse
After executing a cancel/void/refund transaction the terminal responds with a txCancelResponse
to indicate if the transaction has been approved or not.
The table below summarises the contents of the response.
Linux Card Terminals:
A txCancelResponse for an approved cancel/void/refund transaction (without using AADE parameters) looks as follows:
0069|000050|210|04|00||MASTERCARD|537535******1339|856749|000000|16016684
A txCancelResponse for an approved cancel/void/refund transaction (with AADE parameters) looks as follows:
0129|000202|210|04|00||VISA|479273******1768|074056|| 16000198| 16000198|116426114074054|324|2024-09-17T17:40:37.4909369+03:00|
Android Card Terminals:
A txCancelResponse for an approved cancel/void/refund transaction (with AADE parameters) looks as follows:
0177|000028|210|04|00|00|MASTERCARD|************9228|800760|| 16000281|2048160106000202|2048160106||||||||23aee237-1704-4502-a61b-93941e9ad682|2022-02-17T16:21:18.0546831+02:00|2
It is expected that certain transactions will fail for various reasons. A txSaleResponse for a failed transaction looks as follows:
0177|000041|210|04|51|Declined|MASTERCARD|************9228||| 16000281|2048160107000202|2048160107||||||||560ccbc5-c6b1-4375-9639-5096b6eff70d|2022-02-17T16:32:37.4649383+02:00|2
The structure of the message is the same as in the case of an approved transaction.
Differences are limited to two specific fields.
respCodeResp
field where a response code is returned indicating the reason the transaction failed. The table of values provided in txSaleResponse provides typical response codes that may be returned.respMessageResp
where a string is returned providing a textual description of the reason.
Obviously authCodeResp
contain zeros since there is no STAN code available, nor an authorisation code.
Failure reasons
See Failure reasons and ISO codes under txSaleResponse. These are the same for all transaction types (Sales, Cancellations and Pre-auths).
Get Support
If you would like to integrate with Viva, or if you have any queries about our products and solutions, please see our Contact & Support page to see how we can help!