Abort request
An overview of the Abort request message for Android.
Overview
👉 The Abort request is used to attempt to abort a transaction which has been started in the ‘Viva.com Terminal’ application.
In some circumstances, aborting a request is not possible; for example:
- When no transaction has been started
- When the customer’s card has already been read or entered
- When the user has selected to pay via QR code
- When the transaction has already been sent to the server for approval
The client app must implement a mechanism to send messages using Android intents and URI calls and to receive the result in a custom URI callback.
- Abort request originating from the client app to abort (if possible) the last Sale request.
- Abort response originating from the ‘Viva.com Terminal’ application to return the result of an Abort request.
Abort request
For a typical Abort request, the client app must provide the following information:
The above information elements must create a URI call, i.e.
Intent payIntent = new Intent(Intent.ACTION_VIEW, Uri.parse( "vivapayclient://pay/v1"
+ "?merchantKey=MY_MERCHANT_KEY"
+ "&appId=com.example.myapp"
+ "&action=abort"
+ "&referenceNumber=123456"
+ "&callback=mycallbackscheme://result"));
payIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
payIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(payIntent);
Abort response
After executing an abort transaction, the ‘Viva.com Terminal’ application responds with an abort response result to indicate if the abort request has been successful or not. Also, we should state that the response from the abort action is actually a response of a failed transaction.
The result is received as a URI in the callback activity intent:
Uri result = getIntent().getData();
The table below summarises the contents of an approved response.
A cancel response result for an approved refund looks as follows:
mycallbackscheme://result?status=fail&message=(-57) ABORTED&action=ABORT&amount=10&tipAmount=0`
It is expected that if we have not started a transaction the Abort action will respond (-55) NOTHING_TO_ABORT. A failed Abort action response looks as follows:
mycallbackscheme://result?status=fail&message=(-55) NOTHING_TO_ABORT&action=ABORT`
In some cases (when the transaction has been sent to server for approval / user selected payment with QR) the transaction cannot be aborted, and the ‘Viva.com Terminal’ application will not send the Abort response.
Key to card terminal product categories
To understand the icons used on the above tables, see the below table.
Product category | Terminal models | Icon |
---|---|---|
Android Card Terminals | Android Card Terminal Ethernet, Android Card Terminal 4G, Mobile Card Terminal Plus, Mobile Card Terminal. | |
'Viva.com Terminal' application for Android | Mini Card Reader, Pocket Card Terminal connected via Bluetooth or USB to the 'Viva.com Terminal' application for Android. | |
Linux Card Terminals | Countertop, IM20, S900, S800, D200. |
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!