Android app

Applies to: Mini Card Reader, Pocket Card Terminal connected via Bluetooth or USB to the Viva Wallet POS app for Android.

The Viva Wallet POS app for Android can receive requests for initiating transactions from third-party apps installed on the same Android mobile device. Communication with the card terminal app is done by using Android intents. The client app creates an intent with parameters and starts the card terminal app’s pay activity. When the card terminal app’s pay activity finishes it returns the result to the caller app.

Get it on Google Play

A sample app is also available for download from our public GitHub account. It demonstrates the inter-app communication ability and contains all the necessary Gradle build files.

Messages

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. Overall the following messages are available:

Callback activity

The client app must provide a callback activity declare in AndroidManifest.xml, in order to receive the response results.

<activity
          android:name="com.example.URLResponseActivity"
          android:label="Payment Result">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <action android:name="com.example.URLResponseActivity"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <!-- Provide your own scheme here and reference it when you send a message -->
                 <data
                   android:scheme="mycallbackscheme"
                   android:host="result"/>
            </intent-filter>
        </activity>

Sale request

For a typical sale request the client app must provide the following information:

Field Description Example Card terminal support
scheme The Viva custom URL scheme, the host and the version. 'vivapayclient://pay/v1' Android Card TerminalsViva Wallet POS app for Android
merchantKey The merchant's key. For successful validation, should not be empty.
Deprecated: you may pass any value.
'SG23323424EXS3' Android Card TerminalsViva Wallet POS app for Android
appId The client app ID. For successful validation, should not be empty. 'com.example.myapp' Android Card TerminalsViva Wallet POS app for Android
action Sale transaction. For successful validation, should not be empty. 'sale' Android Card TerminalsViva Wallet POS app for Android
clientTransactionId A unique transaction ID transmitted to the host for storage with the transaction. Note that this value will be provided in the Merchant Reference field provided in the sales export response. '12345678901234567890123456789012' Android Card TerminalsViva Wallet POS app for Android
amount Amount in cents without any decimal digits. If action is sale or bill payment, must not be empty. Must be integer and bigger than zero. '1200' = 12 euro Android Card TerminalsViva Wallet POS app for Android
tipAmount How much of the amount in cents is considered as tip without any decimal digits. '200' = 2 euro Android Card TerminalsViva Wallet POS app for Android
withInstallments Enable installments. 'true' Android Card TerminalsViva Wallet POS app for Android
preferredInstallments Number of preferred installments. If the number is between the allowed range and the card supports installments then the flow complete without any prompt for installments. If the number is 0 or > max allowed number of installments then the user will be prompt to enter the number in the app. If the card does not support installments then the app will request from the user how to proceed with the flow. If withInstallments is true preferredInstallments must be integer and not empty. '10' Android Card TerminalsViva Wallet POS app for Android
callback The URI callback that will handle the result. For successful validation, should not be empty. 'mycallbackscheme://result' Android Card TerminalsViva Wallet POS app for Android
show_receipt A flag indicating if the receipt and transaction result will be shown. If true both transaction result and receipt will be shown. If false receipt will not be shown and result will be shown if show_transaction_result is true. 'true' Viva Wallet POS app for Android
show_transaction_result A flag indicating whether transaction result will be shown. 'true' Viva Wallet POS app for Android
show_rating A flag indicating if the rating flow will be shown. 'true' Viva Wallet POS app for Android
ISV_amount The amount the ISV charges. '10' Viva Wallet POS app for Android
ISV_clientId The ID of the ISV client. It is mandatory that if client ID is provided the ISV_amount and ISV_clientSecret parameters should be provided too.
Refer to note below.
'qwerty123456' Viva Wallet POS app for Android
ISV_clientSecret The secret of the ISV client.
Refer to note below.
'qwerty123456' Viva Wallet POS app for Android
ISV_sourceCode The reseller source code of the ISV.
Refer to note below.
'qwerty123456' Viva Wallet POS app for Android

ISV parameter info:

The above information elements must create a URI call, i.e.

Intent payIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                        "vivapayclient://pay/v1"
                                + "?merchantKey="MY_MERCHANT_KEY""
                                + "&appId=com.example.myapp"
                                + "&action=sale"
                                + "&clientTransactionId=1234567801234"
                                + "&amount=1200"
                                + "&tipAmount=200"
                                + "&show_receipt="+true
                                + "&show_transaction_result="+true
                                + "&show_rating="+true
                                + "&tipAmount="+true
                                + "&withInstallments="+10
                                + "&ISV_amount="+10
                                + "&ISV_clientId=qwerty123456"
                                + "&ISV_clientSecret=qwerty123456"
                                + "&ISV_sourceCode=qwerty123456"
                                + "&callback=mycallbackscheme://result"));

payIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

payIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                startActivity(payIntent);

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

Uri result = getIntent().getData()

Sale response

After executing a sale transaction the card terminal app responds with a sale response result to indicate if the transaction has been approved or not.

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

Uri result = getIntent().getData()`

The table below summarises the contents of an approved response.

Field Description Example Card terminal support
callback The URI callback that will handle the result. 'mycallbackscheme://result' Android Card TerminalsViva Wallet POS app for Android
status The status of the transaction. 'success' Android Card TerminalsViva Wallet POS app for Android
message A string containing information about the transaction status. 'Transaction successful' Android Card TerminalsViva Wallet POS app for Android
action Sale transaction. 'sale' Android Card TerminalsViva Wallet POS app for Android
clientTransactionId The client transaction ID. '12345678901234567890123456789012' Android Card TerminalsViva Wallet POS app for Android
amount The amount in cents without any decimal digits. If action is cancel and amount is not empty must be integer and bigger than zero. '1200' = 12 euro Android Card TerminalsViva Wallet POS app for Android
tipAmount How much of the amount in cents is considered as tip without any decimal digits. '200' = 2 euro Android Card TerminalsViva Wallet POS app for Android
verificationMethod The verification method used. 'CHIP-PIN' Android Card TerminalsViva Wallet POS app for Android
rrn The retrieval reference number of the transaction RRN. '123456833121' Android Card TerminalsViva Wallet POS app for Android
cardType The card type. 'VISA' Android Card TerminalsViva Wallet POS app for Android
accountNumber The card number masked. Note that only the 6 first and the 4 last digits are provided. All other digits are masked with stars. '479275\*\*\*\*\*\*9999' Android Card TerminalsViva Wallet POS app for Android
referenceNumber A 6-digit number indicating the transaction's STAN number. '833121' Android Card TerminalsViva Wallet POS app for Android
authorisationCode A 6-digit number indicating the transaction's Authorisation code provided by the host. '690882' Android Card TerminalsViva Wallet POS app for Android
tid A 12 character string indicating the terminal's TID number. ' 16016684' Android Card TerminalsViva Wallet POS app for Android
orderCode The order code. ' 9256110059000200' Android Card TerminalsViva Wallet POS app for Android
shortOrderCode 10-digit integer. '1234567890' Android Card TerminalsViva Wallet POS app for Android
installments Number of installments. ' 10' Android Card TerminalsViva Wallet POS app for Android
transactionDate The transaction date in ISO 8601 format. '2019-09-13T12:14:19.8703452+03:00' Android Card TerminalsViva Wallet POS app for Android
transactionId A unique identifier for the transaction. 'a78e045c-49c3-4743-9071-f1e0ed71810c' Android Card TerminalsViva Wallet POS app for Android
ISV_amount The amount that the ISV charges. '10' Viva Wallet POS app for Android
ISV_clientId The ID of the ISV client. 'qwerty123456' Viva Wallet POS app for Android
ISV_clientSecret The secret of the ISV client. 'qwerty123456' Viva Wallet POS app for Android
ISV_sourceCode The reseller source code of the ISV. 'qwerty123456' Viva Wallet POS app for Android

A sale response result for an approved transaction looks as follows:

mycallbackscheme://result?status=success&message=Transaction successful&action=sale&clientTransactionId=1234567801234&amount=1200&tipAmount=0&verificationMethod=CONTACTLESS - NO CVM&rrn=107715996464&cardType=Debit Mastercard&referenceNumber=996464&accountNumber=537488******9666&authorisationCode=006593&tid=16000223&orderCode=1077172694000223&shortOrderCode=1077172694&transactionDate=2021-03-18T17:07:51.1888432+02:00&transactionId=2161282c-3989-4089-80f1-2ac555dc5f63

It is expected that certain transactions will fail for various reasons. A sale response result for a failed transaction looks as follows:

mycallbackscheme://result?status=fail&message=(-12) TRANSACTION_DECLINED_BY_SERVER&action=sale&clientTransactionId=1234567801234&amount=101&tipAmount=0&verificationMethod=CONTACTLESS - NO CVM&rrn=107715996469&cardType=Debit Mastercard&referenceNumber=996469&accountNumber=537488******9666&tid=16000223&orderCode=1077172696000223&shortOrderCode=1077172696&transactionDate=2021-03-18T17:09:13.1917889+02:00&transactionId=3ca278e7-0679-411e-8279-ebb29ee519b2

The structure of the message is the same as in the case of an approved transaction. Fields such as referenceNumber and authorisationCode may not have values since there is no STAN code available, nor an authorisation code.

Cancel request

For a typical cancel request, or refund, 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' Android Card TerminalsViva Wallet POS app for Android
merchantKey The merchant's key. For successful validation, should not be empty.
Deprecated: you may pass any value.
'SG23323424EXS3' Android Card TerminalsViva Wallet POS app for Android
appId The client app ID. For successful validation, should not be empty. 'com.example.myapp' Android Card TerminalsViva Wallet POS app for Android
action Cancel transaction. For successful validation, should not be empty. 'cancel' Android Card TerminalsViva Wallet POS app for Android
referenceNumber The STAN number of the transaction to be cancelled. If empty, after card presentment, the app will provide a list of the last 3 transactions made with the presented card, allowing the user to select the transaction to be canceled. If action is cancel and if not empty should be integer bigger than zero. Android Card TerminalsViva Wallet POS app for Android
callback The URI callback that will handle the result. For successful validation, should not be empty. 'mycallbackscheme://result' Android Card TerminalsViva Wallet POS app for Android
orderCode If not empty should be integer bigger than zero and length 16. '1020304050607080' Android Card TerminalsViva Wallet POS app for Android
shortOrderCode If not empty should be integer bigger than zero and length 10. '1234567890' Android Card TerminalsViva Wallet POS app for Android
txnDateFrom If action is cancel and if not empty should be in "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" format. '2021-03-18T14:42:53.341Z' Viva Wallet POS app for Android
txnDateTo If action is cancel and if not empty should be in "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" format, txnDateFrom should be provided and txnDateTo should be after txnDateFrom. `2021-03-19T14:42:53.341Z` Viva Wallet POS app for Android
show_receipt A flag indicating if the receipt and transaction result will be shown. If true both transaction result and receipt will be shown. If false receipt will not be shown and result will be shown if show_transaction_result is true. 'true' Viva Wallet POS app for Android
show_transaction_result A flag indicating if transaction result will be shown. 'true' Viva Wallet POS app for Android
show_rating A flag indicating if the rating flow will be shown. 'true' Viva Wallet POS app for Android

The above information elements must create a URI call, i.e.

Intent payIntent = new Intent(Intent.ACTION_VIEW, Uri.parse( "vivapayclient://pay/v1"
				+ "?merchantKey="MY_MERCHANT_KEY"
				+ "&appId=com.example.myapp"
				+ "&action=cancel"
				+ "&referenceNumber=123456"
				+ "&callback=mycallbackscheme://result"
				+ "&orderCode=1020304050607080"
				+ "&shortOrderCode=1234567890"
				+ "&txnDateFrom=2021-03-18T14:42:53.341Z"
				+ "&txnDateTo=2021-03-19T14:42:53.341Z"
				+ "&amount=100"
				+ "&show_receipt="+true
				+ "&show_transaction_result="+true
				+ "&show_rating="+true ));


payIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
payIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
payIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
payIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                startActivity(payIntent);

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

Uri result = getIntent().getData()

Cancel response

After executing a cancel transaction, or refund, the card terminal app responds with a cancel response result to indicate if the refund has been approved or not.

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

Uri result = getIntent().getData()

The table below summarises the contents of an approved response.

Field Description Example Card terminal support
callback The URI callback that will handle the result. 'mycallbackscheme://result' Android Card TerminalsViva Wallet POS app for Android
status The status of the transaction 'success' Android Card TerminalsViva Wallet POS app for Android
message A string containing information about the transaction status. 'Transaction successful' Android Card TerminalsViva Wallet POS app for Android
action Cancel transaction. 'cancel' Android Card TerminalsViva Wallet POS app for Android
amount The amount in cents without any decimal digits. '1200' = 12 euro Android Card TerminalsViva Wallet POS app for Android
cardType The card type. 'VISA' Android Card TerminalsViva Wallet POS app for Android
accountNumber The card number. Note that only the 6 first and the 4 last digits are provided. All other digits are masked with stars. '479275\*\*\*\*\*\*9999' Android Card TerminalsViva Wallet POS app for Android
tid A 12-character string indicating the terminal's TID number. '16016684' Android Card TerminalsViva Wallet POS app for Android
orderCode 16-digit integer. '1020304050607080' Android Card TerminalsViva Wallet POS app for Android
shortOrderCode 10-digit integer. '1234567890' Android Card TerminalsViva Wallet POS app for Android
transactionDate The transaction date in ISO 8601 format. '2019-09-13T12:14:19.8703452+03:00' Android Card TerminalsViva Wallet POS app for Android
transactionId A unique identifier for the transaction. 'a78e045c-49c3-4743-9071-f1e0ed71810c' Android Card TerminalsViva Wallet POS app for Android

A cancel response result for an approved refund looks as follows:

mycallbackscheme://result?status=success&message=Transaction successful&action=cancel&clientTransactionId=1234567801234&amount=1200&tipAmount=0&verificationMethod=CONTACTLESS - NO CVM&rrn=107715996464&cardType=MASTERCARD&referenceNumber=996471&accountNumber=************9666&tid=16000223&orderCode=1077172694000223&shortOrderCode=1077172694&transactionDate=2021-03-18T17:09:50.8747721+02:00&transactionId=5f3ecbbe-d2da-4e59-9d38-610fddd79c73

It is expected that certain transactions will fail for various reasons. A cancel response result for a failed refund looks as follows:

`mycallbackscheme://result?status=fail&message=(-24) REFUND_INVALID_AMOUNT&action=&amount=10000&tipAmount=0&verificationMethod=CONTACTLESS - NO CVM&cardType=Debit Mastercard&referenceNumber=0&accountNumber=537488******9666&tid=16000223&orderCode=0&shortOrderCode=0

The structure of the message is the same as in the case of an approved refund.

Abort request

Using abort action user tries to abort a transaction he started from the third-party app. Abort will not always succeed as in some cases it is not possible to abort the transaction. For a typical abort transaction 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' Android Card TerminalsViva Wallet POS app for Android
merchantKey The merchant's key. For successful validation, should not be empty.
Deprecated: you may pass any value.
'SG23323424EXS3' Android Card TerminalsViva Wallet POS app for Android
appId The client app ID. For successful validation, should not be empty. 'com.example.myapp' Android Card TerminalsViva Wallet POS app for Android
action Cancel transaction. For successful validation, should not be empty. 'abort' Android Card TerminalsViva Wallet POS app for Android
callback The URI callback that will handle the result. For successful validation, should not be empty. 'mycallbackscheme://result' Android Card TerminalsViva Wallet POS app for Android

The above information elements must create a URI call, i.e.

Intent payIntent = new Intent(Intent.ACTION_VIEW, Uri.parse( "vivapayclient://pay/v1"
			+ "?merchantKey=MY_MERCHANT_KEY"
			+ "&appId=com.example.myapp"
			+ "&action=abort"
			+ "&referenceNumber=123456"
			+ "&callback=mycallbackscheme://result"));


payIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
payIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(payIntent);

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

Uri result = getIntent().getData()

Abort response

After executing an abort transaction, the Card Terminal App responds with an abort response result to indicate if the abort request has been successful or not. Also, we should state that the response from the abort action is actually a response of a failed transaction.

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

Uri result = getIntent().getData()

The table below summarises 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 AndroidViva Wallet POS app for Android
status The status of the transaction. 'success' Viva Wallet POS app for AndroidViva Wallet POS app for Android
message A string containing information about the transaction status. 'Transaction successful' Viva Wallet POS app for AndroidViva Wallet POS app for Android
action Cancel transaction. 'abort' Viva Wallet POS app for AndroidViva Wallet POS app for Android

A cancel response result for an approved refund looks as follows:

mycallbackscheme://result?status=fail&message=(-57) ABORTED&action=ABORT&amount=10&tipAmount=0

It is expected that if we have not started a transaction the Abort action will respond (-55) NOTHING_TO_ABORT. A failed Abort action response looks as follows:

mycallbackscheme://result?status=fail&message=(-55) NOTHING_TO_ABORT&action=ABORT

In some cases (when the transaction has been sent to server for approval / user selected payment with QR) the transaction cannot be aborted, and the Card Terminal app will not send the Abort response.

Printing settings request

Using set printing options action, the user can apply changes to printing settings of the POS application from a third-party app. For a typical set printing options 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. 'set_printing_settings' Viva Wallet POS app for Android
businessDescriptionEnabled A flag indicating whether the business description identifier will be printed on the receipt 'true' Viva Wallet POS app for Android
businessDescriptionType The business description identifier that will be printed on the receipt if it is enabled. For successful validation, should be one of the following values: 'businessName', 'tradeName', 'storeName' 'businessName' Viva Wallet POS app for Android
printLogoOnMerchantReceipt A flag indicating whether the logo will be printed on the receipt of the merchant 'true' Viva Wallet POS app for Android
printVATOnMerchantReceipt A flag indicating whether the vat number will be printed on the receipt of the merchant 'true' Viva Wallet POS app for Android
isBarcodeEnabled A flag indicating whether the barcode will be printed on the receipt 'true' Viva Wallet POS app for Android
printAddressOnReceipt A flag indicating whether the address will be printed on the receipt 'true' Viva Wallet POS app for Android
isMerchantReceiptEnabled A flag indicating whether the receipt of the merchant will be printed 'true' Viva Wallet POS app for Android
isCustomerReceiptEnabled A flag indicating whether the receipt of the customer will be printed 'true' 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

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=set_printing_settings"
		+ "&callback=mycallbackscheme://result"
		+ "&businessDescriptionEnabled=true"
		+ "&businessDescriptionType=businessName"
		+ "&printLogoOnMerchantReceipt=true"
		+ "&printVATOnMerchantReceipt=true"
		+ "&isBarcodeEnabled=true"
		+ "&printAddressOnReceipt=true"
		+ "&isMerchantReceiptEnabled=true"
		+ "&isCustomerReceiptEnabled=true";

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);

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

Uri result = getIntent().getData();

Printing settings response

After executing an abort transaction, the Card Terminal App responds with an abort response result to indicate if the abort request has been successful or not. The response from the abort action is actually the response of a failed transaction.

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

Uri result = getIntent().getData();

The table below summarises 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. 'Transaction successful' Viva Wallet POS app for Android
action Set printing settings. For successful validation, should not be empty. 'set_printing_settings' Viva Wallet POS app for Android
businessDescriptionEnabled A flag indicating whether the business description identifier will be printed on the receipt 'true' Viva Wallet POS app for Android
businessDescriptionType The business description identifier that will be printed on the receipt if it is enabled. For successful validation, should be one of the following values: 'businessName', 'tradeName', 'storeName' 'businessName' Viva Wallet POS app for Android
printLogoOnMerchantReceipt A flag indicating whether the logo will be printed on the receipt of the merchant 'true' Viva Wallet POS app for Android
printVATOnMerchantReceipt A flag indicating whether the vat number will be printed on the receipt of the merchant 'true' Viva Wallet POS app for Android
isBarcodeEnabled A flag indicating whether the barcode will be printed on the receipt 'true' Viva Wallet POS app for Android
printAddressOnReceipt A flag indicating whether the address will be printed on the receipt 'true' Viva Wallet POS app for Android
isMerchantReceiptEnabled A flag indicating whether the receipt of the merchant will be printed 'true' Viva Wallet POS app for Android
isCustomerReceiptEnabled A flag indicating whether the receipt of the customer will be printed 'true' Viva Wallet POS app for Android

A cancel response result for an approved refund looks as follows:

mycallbackscheme://result?status=success&message=Printing settings updated&action=set_printing_settings&businessDescriptionType=businessName&printLogoOnMerchantReceipt=false&printVATOnMerchantReceipt=false&isBarcodeEnabled=false&businessDescriptionEnabled=false&printAddressOnReceipt=false&isMerchantReceiptEnabled=false&isCustomerReceiptEnabled=false

Foreground request

Using the foreground action, the user can bring to foreground Android POS App 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. 'set_printing_settings' 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

This action does not send back a response.

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= foreground"
		+ "&callback=mycallbackscheme://result";

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 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 ‘open’ Viva Wallet POS app for Android
batchId This parameter is used only when closing a batch and tries to close the batch with this specific UUID. (Optional) ‘d3fdc9c5-2975-4612-bf52-8c43cd2eb1ba’ Viva Wallet POS app for Android
batchName When opening a new batch, this parameter will be used as the batch name. If no value is provided, the batch will be named automatically.
When closing a batch, this parameter will be used in order to find an open batch with this name. If no value is provided, the currently active batch will be closed.
‘shift’ Viva Wallet POS app for Android

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"
		+ "&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);

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

Uri result = getIntent().getData();

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” for creating a new batch, “close” for closing the batch ‘open’ Viva Wallet POS app for Android
batchId The UUID of the batch that is opened or closed. ‘d3fdc9c5-2975-4612-bf52-8c43cd2eb1ba’ Viva Wallet POS app for Android
batchName The name of the batch that is opened or closed. ‘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

Key to card terminal product categories

To understand the icons used in the above tables, see the below table.

Product category Terminal models Icon
Android Card Terminals Android Card Terminal Ethernet, Android Card Terminal 4G, Mobile Card Terminal Plus, Mobile Card Terminal. Android Card Terminals
Viva Wallet POS app for Android Mini Card Reader, Pocket Card Terminal connected via Bluetooth or USB to the Viva Wallet POS app for Android. Viva Wallet POS app for Android