Set up the development environment
Prepare your development environment before building your in-person card payment integration.
Prerequisites
- An Apple Developer account with organization-level access (iOS only).
- A React Native, iOS, or Android project.
Step 1: Request Apple entitlements (iOS only)
Skip this step if you're building for Android only.
To develop Tap to Pay on iPhone, you need the Tap to Pay on iPhone entitlement from Apple. It applies even if you're developing with React Native.
- Sign in to your Apple Developer account as the Account Holder.
- Submit a request using Apple's entitlement request form.
- On the form, provide the following:
- Your PSP: Stripe.
- Distributed apps using this entitlement: the number of existing apps that will include Tap to Pay.
- New apps using this entitlement: the number of new apps you plan to launch with Tap to Pay.
- Distribution method: public through the App Store.
- Fill in the remaining fields based on your use case: expected number of users, target countries, and expected release date.
- After submitting, Apple sends a confirmation email. Follow Apple's guide to add the Tap to Pay capability to your App ID, download the provisioning profile, and configure the entitlements file.
This entitlement covers development and internal testing only. Before publishing to the App Store or TestFlight, reply to this email to request the production entitlement, then resubmit the form.
Step 2: Install the Stripe Terminal SDK
Swan uses Stripe as its provider for in-person card payments. Install the Stripe Terminal SDK in your project.
Follow this guide to install the SDK. Steps 3 and 4 in Stripe's documentation differ for Swan integrations.
- React Native
- iOS
- Android
The React Native SDK is open source and available on GitHub.
Install it using your package manager:
# npm
npm install @stripe/stripe-terminal-react-native
# Yarn
yarn add @stripe/stripe-terminal-react-native
# Expo
npx expo install @stripe/stripe-terminal-react-native
The Stripe Terminal iOS SDK requires iOS 13 or later.
- CocoaPods
- Swift Package Manager
- Manual
Add the following line to your Podfile, then run pod install:
pod 'StripeTerminal', '~> 4.0'
- In Xcode, select File > Add Packages….
- Enter the SDK URL:
https://github.com/stripe/stripe-terminal-ios - Select a version. The default Up to Next Major is recommended to receive security and feature updates without unexpected breaking changes.
- Go to the latest release on GitHub.
- Download
StripeTerminal.xcframework.zipand unzip it. - Drag the
.xcframeworkinto your Xcode project. - In your target's General pane, under Frameworks, Libraries, and Embedded Content, set
StripeTerminal.xcframeworkto Embed and Sign.
The Android SDK requires AndroidX. Add stripeterminal to your app's build.gradle dependencies:
- Kotlin (build.gradle.kts)
- Groovy (build.gradle)
plugins {
id("com.android.application")
}
android { ... }
dependencies {
implementation("com.stripe:stripeterminal:4.7.3")
}
The SDK requires Java 8. Set your target Java version:
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
apply plugin: 'com.android.application'
android { ... }
dependencies {
implementation "com.stripe:stripeterminal:4.7.3"
}
The SDK requires Java 8. Set your target Java version:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Step 3: Request location permissions
The Stripe Terminal SDK requires foreground location access to determine where payments are made and reduce fraud risks. Payments won't start without it.
Before requesting location access, explain to users why you need it. A brief in-app message before the system prompt improves acceptance rates.
- React Native
- iOS
- Android
Location permission configuration differs by target OS and whether you use React Native CLI or Expo.
Follow Step 2 (Configure your app) in Stripe's guide. Do not continue past that step. The remaining steps differ for Swan integrations.
Add the following key-value pair to your Info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location access is required to accept payments.</string>
Add the location permission to your AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Verify that location access has been granted before using the SDK. In your main activity:
if (ContextCompat.checkSelfPermission(
this,
android.Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
val permissions = arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION)
ActivityCompat.requestPermissions(this, permissions, REQUEST_CODE_LOCATION)
}
Override onRequestPermissionsResult to handle the user's response:
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == REQUEST_CODE_LOCATION
&& grantResults.isNotEmpty()
&& grantResults[0] != PackageManager.PERMISSION_GRANTED
) {
// Location permission denied. The SDK won't allow payments without it.
}
}