Getting Started
Install the SDK, set up the native project and check device requirements.
Requirements
Your app must meet these minimums:
| Requirement | Minimum |
|---|---|
| React Native | 0.83 |
| React | 19.2 |
| iOS deployment target | 16.0 |
| Android compileSdk | 35 |
| Kotlin Gradle Plugin | 2.2 |
Install
npm install @lemonway/terminal@beta @stripe/[email protected]Install the native Tap to Pay module at the exact version above: the SDK is tested with it only. react and react-native must already be in your app.
Yarn or React Native CLIYarn does not install peer dependencies, and the React Native CLI only links native modules listed in your
package.json. Make sure the native Tap to Pay module is in yourpackage.jsonat the version above. To list every peer dependency of the SDK:npm info @lemonway/terminal peerDependencies
Expo Go is not supportedTap to Pay needs native code. Use an Expo development build or the React Native CLI.
Configure the native project
Add the config plugin to app.json, then run npx expo prebuild.
{
"expo": {
"plugins": [
[
"@lemonway/terminal",
{
"locationWhenInUsePermission": "Location access is required to accept in-person payments.",
"iosTapToPayEntitlement": true
}
]
]
}
}| Option | Default | Description |
|---|---|---|
locationWhenInUsePermission | Location access is required to accept in-person payments. | Text of the iOS location permission prompt. |
iosTapToPayEntitlement | true | Adds the iOS Tap to Pay entitlement. Set it to false until Apple has enabled Tap to Pay on your App ID, or iOS signing fails. |
The plugin:
- adds the location permission and the Android permissions,
- sets Android
minSdkVersionto 26 (it never lowers a higher value), - adds the Tap to Pay process guard to
MainApplication, - adds the iOS Tap to Pay entitlement,
- disables R8 minification and resource shrinking in Android release builds to prevent startup failures with the Expo 58 template.
List the plugin after any other plugin that configures release shrinking. Run npx expo prebuild again and rebuild the native app after changing these settings.
Do by hand what the Expo plugin does.
Android
- Set
minSdkVersionto 26 or higher. - Add the required permissions to the main
AndroidManifest.xml.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />- Set these values in
android/gradle.propertiesand ensure the release build type uses them.
android.enableMinifyInReleaseBuilds=false
android.enableShrinkResourcesInReleaseBuilds=false
android.jetifier.ignorelist=jackson-core- In
MainApplication.kt, return early fromonCreate()in the Tap to Pay process, beforesuper.onCreate(). Without it, the app crashes when Tap to Pay starts its own process.
import com.stripeterminalreactnative.TapToPay
override fun onCreate() {
if (TapToPay.isInTapToPayProcess()) {
return
}
super.onCreate()
// ...
}iOS
- Add
NSLocationWhenInUseUsageDescription,NSBluetoothAlwaysUsageDescription,NSBluetoothPeripheralUsageDescriptionandNSLocalNetworkUsageDescriptiontoInfo.plistwith localized usage descriptions. - Once Apple grants the capability, enable it on your App ID, regenerate your provisioning profile, and add the
com.apple.developer.proximity-reader.payment.acceptanceentitlement (Boolean,YES). - Run
pod installinios/and rebuild the app.
Device requirements
Tap to Pay runs on a physical phone only, never on an emulator or simulator.
- iPhone XS or later, on the latest iOS version (not a beta).
- Apple's Tap to Pay on iPhone entitlement for your bundle identifier. Apple first grants a development entitlement; TestFlight and App Store releases need the distribution entitlement.
- On the first connection, a merchant admin accepts Apple's Tap to Pay terms with their Apple ID.
- Apple requires the app to explain Tap to Pay to merchants: follow Apple's Human Interface Guidelines for Tap to Pay on iPhone.
- NFC phone on Android 13 or later, with Google Play services, not rooted, with a recent security patch.
- Release build only. Tap to Pay refuses debuggable builds.
- Developer options off on the phone.
- Location services on, with foreground location permission. Android 13 and later use approximate location.
Testing on a deviceInstall the release build with USB debugging on, then turn Developer options off and open the app from its icon.
PermissionsOn Android,
LemonwayTerminalRootrequests foreground location before initializing. It requestsACCESS_COARSE_LOCATIONon Android 12 and later andACCESS_FINE_LOCATIONon Android 11 and earlier. Real Tap to Pay requires Android 13 or later. Subscribe toterminal.errorbefore mounting the root to handle a denied permission.
Updated 8 days ago