Build and test your app
Learn how to build and test your app using a DevKit.
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 five 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 it off to the Stripe Reader app.
Build the appClient-side
Follow the guidance below for Apps on Devices integrations.
Discover and connect a reader
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.
Screen orientationClient-side
Stripe Android devices have the Auto-rotate screen setting enabled by default. Your app can override this setting by locking the UI to a specific screen orientation.
This can be achieved by setting the screenOrientation attribute on the relevant <activity>
tags in the manifest.
<activity android:name=".MainActivity" android:screenOrientation="portrait"> </activity>
Alternatively, this can be set programatically using Activity::setRequestedOrientation in your Activity
class.
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:
Working with device accessoriesClient-side
When the Stripe reader connects or disconnects from a dock, the Android operation system triggers a configuration change.
By default, your app’s activity is automatically recreated on a configuration change.
To disable automatic activity recreation when connecting to or disconnecting from a dock, add android:configChanges="uiMode"
in the <activity>
entry in your AndroidManifest.
file.
<activity android:name=".MyActivity" android:configChanges="uiMode" />
Your activity can be notified of configuration changes by implementing Activity::onConfigurationChanged. This method is only called if you’ve specified configurations you want to handle with the android:configChanges
attribute in your manifest.
class MainActivity : Activity() { override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) // implement custom configuration change handling logic } }
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.