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 & Italy.

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

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:

Nothing to abort:

Abort request that cannot be processed because of a sale transaction:

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!