Batch request
The client app must implement a mechanism to send messages using URL schemes and to receive the result in a custom URI callback.
- Batch request originating from the client app to open/close (if possible) a batch.
- Batch response originating from the VW POS app to return the result of a batch request.
Batch request
For opening or closing a batch with a request, the client app must provide all the necessary parameters from the table below.
Field | Description | Example |
---|---|---|
scheme | The Viva's custom URL scheme, 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 | Batch request. | 'batch' |
command | Specifies the request action: 'open' to create a new batch, 'close' to end an active batch. | 'open' |
batchName | When opening a new batch this name will be given to the batch. If no value is provided, the batch will be named automatically. When closing a batch this parameter will attempt to close any open batch with this specific name. If no value is provided, the currently active batch will end. (Optional) |
'morningShift' |
batchId | Works only when closing a batch. This parameter will attempt to close any open batch with this specific UUID. (Optional) | '7885F4F1-59CA-42C2-81BB-6DB48AA138A6' |
callback | The URI callback that will handle the result. | 'interapp-callback' |
// USE LIKE THIS
func createBatchRequest(command: String, batchName: String?, batchUUID: String?) {
// construct batch url
var endBatchActionURL = Constants.batchUrlString //vivapayclient://pay/v1?callback=interapp-callback&merchantKey=SG23323424EXS3&appId=com.vivawallet.InterAppDemo&action=set_printing_settings
endBatchActionURL += "&command=" + command
if let batchName = batchName, batchName.isValidName {
endBatchActionURL += "&batchName=" + batchName // name of batch to end
}
if let batchUUID = batchUUID, batchUUID.isValidName {
endBatchActionURL += "&batchId=" + batchUUID // uuid of batch to end
}
(UIApplication.shared.delegate as? AppDelegate)?.performInterAppRequest(request: endBatchActionURL)
}
Examples
Open batch:
vivapayclient://pay/v1?callback=interapp-callback&merchantKey=SG23323424EXS3&appId=com.vivawallet.InterAppDemo&action=batch&command=open&batchName=morningShift
Close batch:
vivapayclient://pay/v1?callback=interapp-callback&merchantKey=SG23323424EXS3&appId=com.vivawallet.InterAppDemo&action&command=close=batch&batchName=morningShift
Batch response
After executing a Batch request the VW POS app will respond accordingly to the type of command you sent.
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. | 'batch' |
command | Specifies the action taken: 'open' for creating a new batch, 'close' for ending an active batch. | 'close' |
batchName | The name of the batch opened/closed. | 'morningShift' |
batchId | The UUID of the batch opened/closed. | |
status | The status of the batch request. | 'success' |
message | A string containing information about the batch status. | 'Batch closed’ |
A Batch response result for an successful batch open or close looks as follows:
Examples
Open Batch:
interapp-callback://?status=success&message=Batch%2520successfully%2520created!&action=batch&batchName=morningShift&batchId=7885F4F1-59CA-42C2-81BB-6DB48AA138A6&command=open
Close Batch:
interapp-callback://?status=success&message=Batch%2520closed&action=batch&batchName=morningShift&batchId=7885F4F1-59CA-42C2-81BB-6DB48AA138A6&command=close
Get Support
If you have any questions about our solutions, or questions about how to integrate with our solutions, please refer to our Get Support page.