1. Terminal SDK
  • API Docs Mexico 🇲🇽
  • Online Payments
    • Release Notes
    • Card Payments
      • Request a card token
      • Make a charge or deferred charge
      • Create payment (tokenless)
      • Request deferred options
      • Refund a transaction
      • Authorize payments
      • Preauthorization (tokenless)
      • Void a transaction
      • Reauthorize payments
      • Capture an authorized payment
      • Bin Info V2
      • Bin Info
      • Validate OTP
    • One-Click and Scheduled Payments
      • Request a recurring charge token
      • Create a recurring charge
      • Make an One-click payment
      • Update recurring charge card data
      • Cancel a recurring charge
      • Update a recurring charge
      • Add a temporary charge or discount
      • Authorize payments
      • Capture an authorized payment
      • Get recurring charge Info
    • Transfer in
      • Get Bank List
      • Request a Transfer In token
      • Init Transaction
      • Get Status
    • Transfer Out
      • Get Bank List
      • Get Bank List V2
      • Request a Transfer Out token
      • Init Transaction
      • Get Status
      • Balance for Payouts
    • Smartlinks
      • Create a Smartlink
      • Get a Smartlink
      • Delete a smartlink
      • Update a Smartlink
    • Payment Button
      • Create a payment button
    • Analytics
      • Get transactions list v1
      • Get transactions list v2
    • Chargebacks
      • Query Chargebacks
      • Request Chargeback Export
    • Commissions
      • Get Commission Configuration
    • Payment Credentials
      • Create a credential
      • Activate or deactivate
      • Delete credential
      • Regenerate a credential
      • Update credential
      • Advanced search
      • Search credentials
    • Platform Status
      • Get platform status
      • Get gateway status
    • Settlement
      • Query settlement
    • Subscription Transactions
      • Get subscription transactions
  • Card Present Billpocket
    • Get Started
      • Create Account
      • User Token
      • API Keys
    • Webhooks
      • Webhooks — Transfer Funds to Your Bank Account
      • Transfer Funds Errors
    • Terminals
      • App Review
      • Splash Screen
    • Card Present Payment Services
      • Cloud Terminal API
        • Collect card payments
        • Print Ticket
        • Cancel Push Notification
        • Get transaction status
        • Collect card payments v2
      • App-to-App
        • Android intents
        • App to App — iOS
        • App to App — Mobile Web
      • Terminal SDK
        • Terminal SDK Android
        • Android SDK errors
    • Card not Present Billpocket Services
      • 3DS Checkout
        • Create checkout
        • Get checkout details
      • E-commerce Flex
        • Get token
        • Validate token
        • Collect payments
        • Refund
        • Capture an authorized payment
        • Get status
    • Catalogs
      • States
      • Municipalities
      • Tax companies
      • Commercial activities
    • User Settings
      • Create user
    • Accounts
      • Clabe Account Setup
        • Add CLABE account
      • Deposit Accounts
        • Add or update CLABE account
    • Transactions
      • Transaction List
        • Get token
        • Get transaction list
        • Get transaction list v2
        • Get transaction list v3
        • Get transaction list v4
      • Cancel Payments
        • Cancel payments Error Codes
        • Cancel payments
  • API Raw Card Present
    • The Amount Object
    • Error Catalog
    • Key Exchange Process
    • Release Notes
    • Test Data
    • One-time payments
      • Single payment
    • Two-step-payments
      • Authorization and capture
    • Voids & Refunds
      • Refund a transaction
      • Void & Reverse
    • Card information
      • Get BIN Info
      • Bin Info V2
      • Request deferred options
    • Query Transactions
      • Transaction Search
    • Webhooks
      • Webhooks — Introduction
      • Good Practices
      • Webhooks — Card Payments
      • Webhooks — Refunds
      • Check Your Webhooks
    • Chargebacks
      • Query Chargebacks
      • Request Chargeback Export
  • Kushki One
    • Error Catalog
    • Release notes
    • Transaction Examples
    • Webhooks
    • Cloud Services
      • Payment
        • Sync
          • Charge
          • Authorization (Pre-auth)
          • Capture
          • Re-authorization
          • Post-tip
          • Void
          • Refund
          • Abort
        • Async
          • Charge (Async)
          • Authorization — Pre-auth (Async)
          • Capture (Async)
          • Re-authorization (Async)
          • Post-tip (Async)
          • Void (Async)
        • Search
          • Transaction Search
      • Print
        • Create Print Job
        • Get Print Job Status
    • Local Services
      • Payment
        • Sync
          • Charge
          • Authorization (Pre-auth)
          • Capture
          • Re-authorization
          • Post-tip
          • Void
          • Refund
          • Abort
        • Async
          • Charge (Async)
          • Authorization — Pre-auth (Async)
          • Capture (Async)
          • Re-authorization (Async)
          • Post-tip (Async)
          • Void (Async)
          • Abort (Async)
        • Search
          • Transaction Search — Online
          • Transaction Search — Local
      • Print
        • Create Print Job
        • Get Print Job Status
        • Print Job Webhook (inbound — implemented by your POS)
  • Appian - Submerchant Register
    • Submerchant Validation in Batch
    • Query submerchant status by requestId/submerchantId
    • Submerchant Document Upload
    • Get submerchantIds
    • Get credentials for submerchants
  • Schemas
    • RequestBodies
      • one-and-two-step-payment
    • Card
    • Channel
    • Amount-cash-in
    • ChargebackListResponse
    • StatusComponent
    • SettlementDateRangeRequest
    • SubscriptionTransactionsResponse
    • amount
    • TransactionResponse
    • PrintJobRequest
    • one-and-two-step-payment-2
    • networkToken
    • ChargebackItem
    • SubscriptionTransaction
    • extra_taxes
    • RawResponse
    • CommandText
    • currency
    • ErrorResponse400
    • ErrorResponse
    • SettlementResponse
    • SettlementRecord
    • webhooksItem
    • card
    • CardData
    • CommandColumns
    • Amount
    • Country
    • ErrorResponse401
    • card_details
    • LinkFailure
    • ColumnItem
    • extraTaxes
    • ErrorResponse403
    • enc_tlv
    • CommandDivider
    • TransactionEvent
    • Deferred
    • payment_method
    • ErrorResponse500
    • deferred
    • CommandFeed
    • TransactionStatus
    • pos_details
    • CommandSpace
    • ReadingType
    • ContactDetails
    • contact_details
    • sub_merchant
    • CommandCut
    • FailureReason
    • documentType
    • Subscription
    • metadata
    • CommandImage
    • EventTerminal
    • orderDetails
    • Language
    • TransactionSearchRequest
    • CommandQR
    • EventOperation
    • Shipping Address
    • payment_submethod
    • CommandBarcode
    • EventAmount
    • Billing-Address
    • SubscriptionUpdate
    • EventExtraTaxes
    • PrintJobAccepted
    • product
    • SubscriptionAdjustmentRequest
    • PrinterError
    • EventMetadata
    • threeDomainSecure
    • AmountWithTaxes
    • PrintJobStatus
    • PrintJobStatusRequest
    • webhooks
    • AmountCore
    • headers
    • ExtraTaxes
    • PrintWebhookPayload
    • Metadata
    • webhooksChargeback
    • citMit
    • AmountWithTip
    • network
    • TransactionSearchBody
    • TransactionSearchOnlineBody
    • binInfo
    • AmountWithOptionalTip
    • TransactionSearchLocalBody
    • messageFields
    • TransactionEvent_2
    • UnexpectedErrorResponse
    • FailureReason_2
    • transactionType
    • ExternalReferenceId
    • EventTerminal_2
    • ExternalSubscriptionId
    • EventOperation_2
    • EventAmount_2
    • EventExtraTaxes_2
    • EventMetadata_2
    • SettlementTicketRequest
BienvenidaPerú 🇵🇪México 🇲🇽
Ecuador 🇪🇨Colombia 🇨🇴Chile 🇨🇱
BienvenidaPerú 🇵🇪México 🇲🇽
Ecuador 🇪🇨Colombia 🇨🇴Chile 🇨🇱
  1. Terminal SDK

Terminal SDK Android

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.
INFO
Service available in Mexico 🇲🇽 only.

Requirements#

In order to integrate your application through the SDK, you must meet the following requirements:
A valid account
A supported POS terminal

Importing the Android SDK#

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:
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
    tools:ignore="QueryAllPackagesPermission" />
Note
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.

Plugins#

Install the following plugins, necessary for the correct functioning of the SDK, in your build.gradle file:

Repositories#

Add the following repositories in your settings.gradle file:

Initializing the SDK#

Initialize the SDK by setting your user token and environment via the initSDK() method.
PropertyTypeRequiredDescriptionAllowed values
contextObjectYESandroid.content.Context.
sdkModeObjectYESInitBillpocketSDK.SdkMode.TEST, PRODUCTION
userTokenStringYESYour user token.
deviceTokenStringNODevice ID. Available from version 2.8.4 onwards. It can be viewed and renamed from the Billpocket dashboard, My devices section.
listenerObjectYESEventListenerInitSDK.
Send eventListener as an object that implements the EventListenerInitSDK interface to listen to the initialization result:
Note
This method also automatically connects to Ultra and Ultra P terminals, so it is not necessary to call the connectReader method for those models.

Connecting a Bluetooth reader#

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.

Connect the selected reader#

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:

Disconnecting a Bluetooth reader#

Use the disconnectReader method to disconnect a previously connected Bluetooth reader:
Implement the resultReaderDisconnection method of the EventListenerDisconnection interface to listen to the result of the operation:
Implement the onQposDisconnected method to perform an action when a terminal is turned off after a period of non-use:

Starting a transaction#

Use the doTransaction method to start a transaction with the terminal. You must establish the required parameters at the time of making the request.
PropertyTypeRequiredDescription
contextObjectYESandroid.content.Context.
amountNumberYESTransaction amount.
descriptionStringYESTransaction description.
locationObjectYESInstance of the android.location.Location object with latitude and longitude of the transaction source.
tipNumberNOTransaction tip (if any).
listenerObjectYESInstance of EventListenerTransaction.
rotationSignatureBooleanNOSet true to display the signature screen vertically, or false to display it horizontally.
To use this method, make sure to first include the following import:
Send a request to the terminal to start a transaction:
Set eventListener as an object that implements the EventListenerTransaction interface to listen for transaction events:
There are other methods that allow you to cover the different payment flows correctly.

onMagneticCardFound#

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.

selectAplication#

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.
PropertyTypeRequiredDescription
itemSelectedIntegerYESSelected item.

Meses sin intereses (MSI)#

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:
PropertyTypeRequiredDescription
msiIntegerYESSelected item.

Cardholder authentication#

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.

PIN authentication#

To implement this functionality, include the following dependency in your build.gradle file:
You can download the dependency from the Card-present Mexico BP apps repository.
Add the following activities in your AndroidManifest.xml file:
<application
    ...

    <activity
        android:name="com.billpocket.minerva.core.PlainPINCaptureActivity"
        android:excludeFromRecents="true"
        android:exported="false"
        android:permission="com.billpocket.minerva.permission.SECURE_PIN_INPUT"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateAlwaysHidden"/>

    <activity
        android:name="com.billpocket.minerva.core.RSAKeyPINCaptureActivity"
        android:excludeFromRecents="true"
        android:exported="false"
        android:permission="com.billpocket.minerva.permission.SECURE_PIN_INPUT"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateAlwaysHidden"/>
</application>
Implement the startForActivityResult(intent, code) or activityResultLauncher.Launch(intent) callback to perform PIN authentication:
Implement the function BluetoothReaderTransaction.continueTransactionWithPIn(result.data, eventListener) to get the result of the activity.
PropertyTypeRequiredDescription
result.dataObjectYESIntent from the activity result.
listenerObjectYESInstance of EventListenerTransaction.

Signature authentication#

Add the following activity in your AndroidManifest.xml file:
<application
    ...

    <activity
        android:name="com.billpocket.bil_lib.SignatureActivity"
        android:excludeFromRecents="true"
        android:exported="false"
        android:permission="com.billpocket.minerva.permission.SECURE_PIN_INPUT"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateAlwaysHidden"/>
</application>
Implement the startForActivityResult(intent, code) or activityResultLauncher.Launch(intent) callback to perform electronic signature authentication:
Implement the function BluetoothReaderTransaction.continueTransactionWithSignature(result.data) to get the result of the activity.
PropertyTypeRequiredDescription
result.dataObjectYESIntent from the activity result.

Response callbacks#

A transaction can result in success or error depending on the result. Below is the list of available callbacks.

onTransactionSuccessful#

Called when the transaction is successful. transactionData contains all the information about the transaction.

onTransactionFinished#

Called when a magnetic stripe payment is made or an error has occurred during the transaction.

onTransactionAborted#

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.

EventListenerTransaction#

Below is the list of events available for a transaction.

Get transaction list#

Get the list of previous transactions via the getHistoryTransaction method:
The result is returned in the resultHistoryTransaction callback of the EventListenerHistoryTransactions interface:

Refund#

Select a transaction from the list of authorized transactions in order to perform a refund:
Implement the resultHistoryTransaction method of the EventListenerHistoryTransactions interface:
Call the refundPayment method to perform a refund:
Implement the resultRefundPayment method of the EventListenerRefundPayment interface to get the result:

Print ticket#

Print by transaction ID#

To print the purchase ticket, call the printTicket method:

Print ticket copy#

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:
Implementation example:

Print result#

Implement the onResult callback of the EventListenerPrinter interface to get the response from the operation:

Print a bitmap#

You can print a ticket by sending a bitmap via the printTicketImage method:
The response is returned through the same onResult callback of the EventListenerPrinter interface.
Do you need access to the terminal printer?
Check the manufacturer's documentation.

Message tracking#

Implement the following optional methods to obtain more information while using the SDK.

Transaction#

Method for obtaining information during a transaction:

SDK init#

Method to obtain information during the SDK initialization process:

Reader connection#

Method to obtain information during the connection process with a terminal:

Resources#

SDK demo
Android SDK errors

Got a suggestion on this documentation? Contact us.
Modified at 2026-08-25 20:23:04
Previous
Terminal SDK
Next
Android SDK errors
Built with