iOS app integration
Information on our iOS app integration solution.
Overview
Please see below for information on integrating with Viva Wallet’s iOS Viva Wallet POS App.
The Viva Wallet VW POS App for iOS can receive requests for initiating transactions from third-party apps installed on the same iOS mobile device. Communication with the VW POS App is done through the use of URL schemes and by implementing UIApplicationDelegate’s instance method application(_:open:options:) on the AppDelegate file of the client’s app project. The client app should create an URL scheme using specific parameters that will initiate the VW POS App’s pay activity. When the VW POS App’s pay activity finishes it returns the transaction result to the caller app.
ToP (Tap-on-Phone) is for Apple devices with iOS 11 or above
Messages
The client app must implement a mechanism to send messages using URL schemes and to receive the result in a custom URI callback.
Sales-related requests
- Sale request originating from the client app to initiate a request for a new Sale transaction
- Pre-auth request originating from the client app to initiate a request for a new Pre-auth transaction.
- Capture Pre-auth request originating from the client app to initiate a request for a Capture Pre-auth transaction.
- Cancel request originating from the client app to initiate a request for a Cancel/Refund transaction
- Abort request originating from the client app to abort (if possible) the last request
- Batch request originating from the client app to open/close (if possible) a batch
- Reprint request originating from the client app to reprint a transaction receipt
Configuration-related requests
- Set Printing Settings request originating from the client app to set the Viva Wallet POS App printing settings
- Get Printing Settings request originating from the client app to get the Viva Wallet POS App’s printing settings
- Send Logs request originating from the client app to open/close (if possible) a batch
- POS Activation request originating from the client app to trigger the POS activation
- Get Activation Code request originating from the client app to trigger the Get Activation Code request
Callback activity
The card terminal app will deliver the URL to your app by calling your app delegate’s application(_:open:options:) method. The following code should be added to the method in order to parse the contents of the URL and take the appropriate actions. To ensure the URL is parsed correctly, use NSURLComponents APIs to extract the components.
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
let path = components.path,
let params = components.queryItems else {
print("Invalid URL or path missing")
return false
}
print("Path: \(path)\nComponents: \(params)")
//MARK: - Do any additional actions after parsing the data
return true
}
func performInterAppRequest(request: String){
guard let url = URL(string: request) else { return } // url with constructed parameters
UIApplication.shared.open(url) { (result) in
print("InterApp Request URL:\n", url)
if result {
// The URL was delivered successfully!
}
}
}
Get Support
If you would like to integrate with Viva Wallet, or if you have any queries about our products and solutions, please see our Contact & Support page to see how we can help!