Abort request
An overview of the Abort request message for iOS.
Our ‘Viva.com Terminal’ application (tap-on-phone) supports Apple Tap to Pay in the UK, the Netherlands, France, Austria, Czech Republic, Ireland, Romania, and Sweden, Italy & Germany.
Overview
👉 The Abort request is used to attempt to abort a transaction which has been started in the Viva.com Terminal App.
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 URL schemes and to receive the result in a custom URI callback.
- Abort request originating from the client app to abort (if possible) the last request.
- Abort response originating from the Viva.com Terminal App to return the result of an Abort request.
Abort request
For a typical Abort request, the client app must provide the following information:
Field | Description | Example |
---|---|---|
scheme | The Viva's custom URLscheme, the host and the version. | 'vivapayclient://pay/v1' |
merchantKey | The merchant's key. For successful validation, should not be empty. Deprecated: you may pass any value. |
'SG23323424EXS3' |
appId | The client app id. | 'com.example.myapp' |
action | Abort request. | abort |
callback | Your custom URI callback that will handle the result. | 'interapp-callback' |
The above information elements must create a URI call, i.e.
let abortAction = "&action=abort"
func createAbortRequest() {
let abortActionURL = schemeURL + callback + merchantKey + clientAppID + abortAction
return abortActionURL
}
func performInterAppRequest(request: String){
guard let url = URL(string: request) else { return } // url with constructed parameters
UIApplication.shared.open(url) { (result) in
if result {
// The URL was delivered successfully!
}
}
}
//USE LIKE THIS
let abortActionURL = createAbortRequest()
performInterAppRequest(request: abortActionURL)
Example:
vivapayclient://pay/v1?callback=interapp-callback&merchantKey=SG23323424EXS3&appId=com.vivawallet.InterAppDemo&action=abort
Abort response
After executing an abort request the Viva.com Terminal App may or may not respond depending on its state. E.g. if the Viva.com Terminal App is in the middle of a sale you won’t receive an abort response but you will receive the sale response.
The result is received as a URI in the callback activity.
The table below summarizes the contents of a response.
Field | Description | Example |
---|---|---|
callback | The URI callback that will handle the result. | 'interapp-callback://result' |
action | The action. | 'abort' |
status | The status of the abort. | 'success' |
message | A string containing information about the abort status. | 'nothing to abort / aborted' |
An Abort response result for an approved transaction looks as follows:
Examples
Successful abort:
interapp-callback://result?status=success&message=Aborted&action=abort
Nothing to abort:
interapp-callback://result?status=failure&message=Nothing%2520to%2520abort&action=abort
Abort request that cannot be processed because of a sale transaction:
interapp-callback://result?status=success&message=Transaction%2520successful&action=sale&accountNumber=537489******8493&amount=500&authorisationCode=654321&cardType=Debit%2520Mastercard&orderCode=0287160005000168&referenceNumber=800594&rrn=028713800594&tid=16000168&tipAmount=0&transactionDate=2020-10-13T16%253A59%253A44.973+0300&transactionId=bef6653d-913c-4dda-b97b-8b0bebbc47f7&verificationMethod=Contactless
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!