Connect to a reader
Connect your application to a Stripe Terminal reader.
Note
If you haven’t chosen a reader yet, compare the available Terminal readers and choose one that best suits your needs.
Bluetooth-connected readers are Bluetooth LE devices. They collect payment details, but rely on a paired mobile device for communication with Stripe.
Follow these steps to connect your app to a Terminal reader using Bluetooth:
Caution
Don’t use mobile device settings to pair with your reader. Pairing the reader through device settings makes the reader unavailable to connect to your app.
Discover readersClient-side![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
First, turn on the reader. Then, from your app, search for nearby Bluetooth-connected readers using the discoverReaders method.
Bluetooth scan ![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Bluetooth scan searches for all nearby readers and returns a list of discovered readers to your app. As the discovery process continues, the SDK continues to invoke the onUpdateDiscoveredReaders
method with the latest list of nearby readers.
With the Bluetooth scan discovery method, you can set a timeout to scan for a set period of time, which you can use for managing battery life or triggering an error message if no devices are found.
In your mobile application, we recommend displaying an auto-updating list of discovered readers, with serial numbers or labels to help users identify their reader.
Connect to a readerClient-side![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
To connect to a discovered reader, call the connectBluetoothReader
method from your app. As soon as the SDK connects to the reader, the reader’s status light shines solid blue.
You must register your reader to a location upon connection. To do so, create and use a BluetoothConnectionConfiguration
with the locationId
set to the relevant location ID when connecting.
Don’t program your app to call disconnectReader
to conserve power. The reader efficiently handles power management using its standby mode.
Handle reader disconnects ![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Reader disconnects can sometimes occur between your app and the reader. For example, the reader can disconnect from your app if it’s out of range or runs out of battery. You can simulate an unexpected disconnect while testing by powering off the reader.
The ReaderListener
includes a onDisconnect
callback that provides your application with the DisconnectReason
to help identify why the reader disconnected.
When a reader disconnects, we recommend you automatically attempt reconnection and display notifications in your app relaying the reader status throughout the process.
To implement automatic reconnection:
- Set
autoReconnectOnUnexpectedDisconnect
to true on theConnectionConfiguration
. - Implement the callbacks found in the
ReaderReconnectionListener
. - Pass a
bluetoothReaderReconnectionListener
to yourConnectionConfiguration
. - When the SDK sends onReaderReconnectStarted to your app, display a message announcing that the reader lost connection and reconnection is in progress.
- You can use the
Cancelable
object to stop the reconnection attempt at any time.
- You can use the
- When the SDK indicates successful reconnection by sending onReaderReconnectSucceeded, display a message announcing the connection was restored and to continue normal operations.
- If the SDK can’t reconnect to the reader and sends onReaderReconnectFailed, display a message stating that an unexpected disconnect occurred.
If you don’t configure automatic reconnection, you can handle the disconnect callback to just display a message in the app alerting the user that the reader unexpectedly disconnected and initiate reader discovery and connection.
Reboot the connected reader![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Stripe Reader M2 and BBPOS WisePad 3 automatically reboot after operating for 24 hours. However, you can force the reader to reboot and reset its 24-hour timer by using the rebootReader
API. After this action, the reader disconnects from the SDK and then reboots. If you’re using automatic reconnect, the SDK attempts to restore the connection with the reader.
Automatic reconnection on application start![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Stripe Terminal doesn’t automatically reconnect to a reader when your application starts. Instead, you can build a reconnection flow by storing reader IDs and attempting to connect to a known reader on startup.
- When you successfully connect to a reader, save its serial number in a persistent data storage location, such as the Shared Preferences API (Android).
- When your app launches, check the persistent data storage location for a saved serial number. If one is found, call the
discoverReaders
method so your application can try to find that reader again. - If the saved serial number matches any of the discovered readers, try connecting to that reader with the matching reader object returned from the call to
discoverReaders
. If the previously connected reader isn’t found, stop the discovery process.
Display some UI during the discovery and connection process to indicate that an automatic reconnection is happening.
Update reader softwareClient-side![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Your application must update Bluetooth and USB readers to apply:
- Regional configurations that keep you up to date with card network and issuer requirements
- Security updates
Required updates start installing on connection to the reader. You can’t use the reader until updating completes.
Note
In order to install updates, the reader’s battery level must be higher than 50%.
Required updates ![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
When immediately required updates are available for the reader, the integration’s ReaderListener
receives onStartInstallingUpdate
with a ReaderSoftwareUpdate
.
The ReaderSoftwareUpdate
provides the necessary details of the update including an estimate of the total update duration, indicated by timeEstimate
.
During the installation process, the Terminal’s connectionStatus
transitions to ConnectionStatus.
while the update is installing on the reader.
Your application must notify users that an update is installing and display the progress in your UI. Make it clear why connecting is taking longer than normal.
If the required update process fails, Stripe communicates the error to the ReaderListener
with onFinishInstallingUpdate
. You can’t reconnect to the reader after a required update fails, unless the following conditions are met:
- The reader runs the latest software version for the location within the last 30 days.
- The Android SDK version is greater than or equal to
3.
.5. 0
If the conditions are met, the connection process succeeds despite the required update being incomplete. Stripe retries the required update the next time you connect to that reader until it’s successfully installed.
You can cancel required updates using the Cancelable
object. However, this results in a failed connection to the reader. For incremental-only updates, no Cancelable
is provided because you can’t cancel these updates.
Optional updates ![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
You can defer optional updates until the specified date, after which they become required. The SDK notifies you of optional updates through the ReaderListener
any time the reader is connected but not performing a transaction. If an optional update is available, your application’s ReaderListener
receives the onReportAvailableUpdate
callback with the ReaderSoftwareUpdate
object containing the update details, including:
- Estimated time for update to complete (
timeEstimate
) - Date after which the update becomes required (
requiredAt
).
In your application, notify users that an update is available, and display a prompt to optionally continue with the update.
To proceed with the update previously reported with onReportAvailableUpdate
, call Terminal.
.
The available update is also stored on the reader object as reader.
.
As the update proceeds, block the user from leaving the page in your app, and instruct the user to keep the reader in range and powered on until the update completes. We recommend also providing your user with a visual indicator of the update’s progress. The ReaderListener
reports the update’s progress in the onReportReaderSoftwareUpdateProgress
method.
When an optional update’s requiredAt
date has passed, the update is installed the next time the reader is connected to.
See Testing reader updates to learn more about making sure your application handles the different update types that a reader can have.
Next steps![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
You’ve connected your application to the reader. Next, collect your first Stripe Terminal payment.
The BBPOS and Chipper™ name and logo are trademarks or registered trademarks of BBPOS Limited in the United States and/or other countries. The Verifone® name and logo are either trademarks or registered trademarks of Verifone in the United States and/or other countries. Use of the trademarks does not imply any endorsement by BBPOS or Verifone.