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 originating from the client app to open or close a batch.
- Batch response originating from the card terminal app to return the result of a Batch request.
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:
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.
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.