Build and test your app
Use your SmartPOS DevKit device to test and iterate your application without going through the deployment, app review, or signing process.
If you need a DevKit device, you can order up to 5 per user from the Readers section in your Dashboard.
Set up the DevKit
Before you can use your DevKit for app development, you must do the following:
- Follow the on-screen prompts to connect to a network.
- Register the device to your Stripe account.
- Install all available updates.
After the initial setup, you can register your DevKit to another account or location at any time. To do so, connect the DevKit to the internet and follow the steps to register a reader.
While similar to production devices, DevKit devices:
- Can only operate in test mode.
- Ship with developer options and Android Debug Bridge (
adb
) enabled by default. - Display an on-screen watermark to indicate that the device is only used for testing. The watermark moves around the screen while the device is in use so that you can see all parts of the screen.
The Terminal API supports targeting registered DevKit devices.
Develop your app for Stripe devices
Use the following steps to develop your app for Stripe Android devices, including setting up the app and handing off to the Stripe Reader app.
Set up the appClient-side
First, set up your integration for in-person payments. Then, follow the guidance below for Apps on Devices integrations.
Add dependencies
Add the following dependencies to your project’s Gradle build script. Apps on Devices integrations require Terminal Android SDK version 2.22.0
or later. We recommend that you integrate with the latest version.
Make sure that you aren’t using any other Stripe Terminal SDK dependencies. For example, if you previously integrated the Terminal Android SDK, don’t use the top-level com.stripe:stripeterminal
dependency (for example, com.stripe:stripeterminal:3.5.0
).
See an example of including dependencies in your app’s build script.
Configure your application
To inform the Stripe SDK of lifecycle events, add a TerminalApplicationDelegate.onCreate() call to the onCreate() method for your application subclass.
In your app manifest, specify the name of your Application
subclass with the android:name
attribute.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application android:name=".MyApp"> <!-- App manifest contents --> </application> </manifest>
Learn more about setting up your integration or see the Apps on Devices sample app GitHub repository for an example of configuring the Application subclass.
Build the appClient-side
Follow the guidance below for Apps on Devices integrations.
Discover and connect a reader
You must register a new Stripe device to your account as a new Reader object. Use the pairing code provided in the device’s admin settings to create the Reader object. Your app uses the Stripe Terminal Android SDK to discover and connect to your device:
- Your app runs on your registered device.
- Your app discovers the reader by calling discoverReaders with DiscoveryConfiguration.HandoffDiscoveryConfiguration.
- Your app connects to the reader by using connectHandoffReader.
The following example shows how to discover and connect to a Stripe reader using handoff mode in an Android app:
Collect payments
After you connect to the reader using handoff mode, you can start collecting payments.
The Stripe Reader app handles payment collection and other payment operations, such as saving a card. When initiating a payment operation, the Stripe Reader app becomes the primary and launches in full screen. Then, the Stripe Reader app guides the customer through the flow and returns control to your app after completion (success or failure) or customer cancellation. When control returns to your app, the Stripe Reader app continues to run in the background.
See an example of collecting payment in an Apps on Devices app.
Collect payments while offline Beta
Apps on Devices supports offline payment collection.
Device managementClient-side
You can access the device’s admin settings by launching the stripe://settings/
deep-link URI from your app.
See an example of launching the admin settings deep-link URI.
Instrument the appClient-side
Stripe doesn’t provide an application-level instrumentation solution. To keep track of crashes and other logs from your application, you can use a third-party library such as Sentry or Crashlytics.
Set the device localeClient-side
The device user’s language selection (not country) informs the value returned by Locale.getDefault(). You can change the device language in the admin settings.
LimitationsClient-side
Stripe Android devices don’t render a system UI, including a back button or status bar.
If your app needs to communicate battery level, charging state, and connectivity status to the user, refer to the following Android API docs for guidance:
Test your app
Use your S700 DevKit device to test your app in the Stripe Dashboard or using the Android Debug Bridge (adb
).
Test payments
DevKit devices can process test payments using a Stripe physical test card, which you can order in the Dashboard. When testing payments, you can use decimal amounts to produce specific outcomes.
Warning
Don’t use real cards for test payments on DevKit devices.