Accept card-present payments through a terminal directly from your Android app. The Android SDK allows you to communicate securely with a terminal and perform different operations, giving you complete control of the application's user interface.Unlike the App to App integration, the SDK integration does not require you to have the POS app installed on your device.
Import the SDK to your project by adding the following lines to your build.gradle file:
If you are integrating an Ultra SE reader, you need to add the following permission to your AndroidManifest.xml file in order to initialize the SDK correctly:
If you are using a version lower than 2.8.1 and plan to update the SDK version in your app, take note of the permission above to avoid problems initializing the SDK.
Link the terminal with your mobile device via Bluetooth so that it can be found by the SDK.Get the available readers using the getListBluetoothReaders method:
Implement the resultListReaders method of the EventListenerConnection interface to listen to the result:
Bluetooth permissions on Android API level lower than 31#
For devices with an Android API level lower than 31, you need to verify Bluetooth permissions:
Note
The resultListReaders method is not available for Ultra and Ultra P terminals.
When a reader is selected from the returned options, use the connectReader method. Get the type, macAddress and name parameters from the previously selected BluetoothDevice object.
Implement the resultReaderConnect method of the EventListenerConnection interface to listen to the result of the connection:
Called by the SDK to indicate that the card is read using a magnetic stripe, so you must invoke the onContinueTransactionWithMagneticCard() method to continue with the payment flow:
The SDK automatically calls the doOnTransaction method after the invocation of onMagneticCardFound to continue the transaction.
If the read card has more than one payment option, the SDK calls the selectAplication method with the list of available options, so you can select one and continue the operation:
To continue with the transaction, call BluetoothReaderTransaction.continueWithAppIndex(itemSelected) sending the selected option.
If the sale is greater than or equal to $300 MXN, the onMsiDefined callback is called with a list of all the available Q6Descriptor options to defer the transaction.
Note
You must implement this callback even if you do not plan to offer the deferred option, in order to continue the payment flow during a transaction.
If you do not want to defer a sale, choose the last option returned from the Q6Descriptor list (Q6Descriptor{installments=0, minAmount=0, commission=0}).Example of returned Q6Descriptor values
Continue the process by calling the continueTransactionWithMSI method once the correct defer option has been selected:
Perform authentication through the cardholder's Personal Identification Number (PIN) or through an electronic signature to process the transaction. The type of authentication depends on the card.
If the operation is aborted — for example, the terminal was disconnected or a card read timed out — the onTransactionAborted callback is executed to indicate the result of the operation.
Starting from version 2.8.5, the requestPrintCopy callback is used to prompt the user with a dialog asking whether they want to print a copy of the ticket.
requestPrintCopy() calls continueWithPrintTicketCopy with either true (print) or false (skip printing), based on the user's selection: