Batch request

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.

Batch request

With the batch action the user can open a new batch or close an active one from a third-party app. For a typical foreground request, the client app must provide the following information:

Field Description Example Card terminal support
scheme The Viva's custom URL scheme, the host and the version. 'vivapayclient://pay/v1' Viva Wallet POS app for Android
merchantKey The merchant's key. For successful validation, should not be empty.
Deprecated: you may pass any value
'SG23323424EXS3' Viva Wallet POS app for Android
appId The client app ID. For successful validation, should not be empty. 'com.example.myapp' Viva Wallet POS app for Android
action Set printing settings. For successful validation, should not be empty. 'batch' Viva Wallet POS app for Android
callback The URI callback that will handle the result. For successful validation, should not be empty. 'mycallbackscheme://result' Viva Wallet POS app for Android
command Specifies the request action.

“open” to create a new batch

“close” to close the batch

“printSummary“ to print the summary of the batch
‘open’ Viva Wallet POS app for Android
batchId For “open“ command this parameter is not used.

For “close“ command, if this parameter is provided, Android POS tries to close the batch with this specific UUID. (Optional)

For “printSummary“ command, if this parameter is provided, Android POS tries to print the summary of the batch with this specific UUID. (Optional)
‘d3fdc9c5-2975-4612-bf52-8c43cd2eb1ba’ Viva Wallet POS app for Android
batchName For “open“ command, if this parameter is provided it will be used as the batch name. If no value is provided, the batch will be named automatically. (Optional)

For “close“ command, if this parameter is provided, it will be used in order to find an open batch with this name.(Optional)

For “printSummary“ command, if this parameter is provided, Android POS tries to print the summary of the batch with this specific name. (Optional)
‘shift’ Viva Wallet POS app for Android

For “close” and “printSummary“ commands if neither “batchId” nor “batchName” are provided the command will be applied in the current active batch.

In order to open a new batch, the above information elements must create a URI call, i.e.

String reqStr = "vivapayclient://pay/v1"
		+ "?merchantKey="MY_MERCHANT_KEY"
		+ "&appId=com.example.myapp"
		+ "&action=batch"
		+ "&callback=mycallbackscheme://result"
		+ "&command=open"
		+ "&batchName=shift";

Intent payIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(reqStr));
payIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
payIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(payIntent);

In order to close an active batch, the above information elements must create a URI call, i.e.

String reqStr = "vivapayclient://pay/v1"
		+ "?merchantKey="MY_MERCHANT_KEY"
		+ "&appId=com.example.myapp"
		+ "&action=batch"
		+ "&callback=mycallbackscheme://result"
		+ "&command=close";

Intent payIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(reqStr));
payIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
payIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(payIntent);

In order to print the summary of an active batch, the above information elements must create a URI call, i.e.

String reqStr = "vivapayclient://pay/v1"
		+ "?merchantKey="MY_MERCHANT_KEY"
		+ "&appId=com.example.myapp"
		+ "&action=batch"
		+ "&callback=mycallbackscheme://result"
		+ "&command=printSummary";

Intent payIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(reqStr));
payIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
payIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(payIntent);

Batch response

After executing a batch request, the Card Terminal App responds with a batch response result to indicate if the batch request has been successful or not

The result is received as a URI in the callback activity intent:

Uri result = getIntent().getData();

The table below summarizes the contents of an approved response.

Field Description Example Card terminal support
callback The URI callback that will handle the result. 'mycallbackscheme://result' Viva Wallet POS app for Android
status The status of the transaction. 'success' Viva Wallet POS app for Android
message A string containing information about the transaction status. 'Batch successfully created!' Viva Wallet POS app for Android
action Cancel transaction. 'batch' Viva Wallet POS app for Android
command Specifies the request action.

“open” to create a new batch

“close” to close the batch

“printSummary“ to print the summary of the batch
‘open’ Viva Wallet POS app for Android
batchId The UUID of the batch that the command was applied on. ‘d3fdc9c5-2975-4612-bf52-8c43cd2eb1ba’ Viva Wallet POS app for Android
batchName The name of the batch that the command was applied on. ‘shift’ Viva Wallet POS app for Android

A batch response result for opening a batch looks as follows:

mycallbackscheme://result?status=success&message=Batch successfully created!&action=batch&command=open&batchId=d3fdc9c5-2975-4612-bf52-8c43cd2eb1ba&batchName=shift

A batch response result for closing a batch looks as follows:

mycallbackscheme://result?status=success&message=Batch successfully closed!&action=batch&command=close&batchId=d3fdc9c5-2975-4612-bf52-8c43cd2eb1ba&batchName=shift

A batch response result for printing the summary of a batch looks as follows:

mycallbackscheme://result?status=success&message=Batch summary successfully printed!&action=batch&command=printSummary&batchId=d3fdc9c5-2975-4612-bf52-8c43cd2eb1ba&batchName=shift

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.