# Set up your integration

Set up a Stripe Terminal SDK or server-driven integration to accept in-person payments.

# React Native


This guide uses version `0.0.1-beta.34` or later. If you’re upgrading an existing integration, follow the [React Native SDK migration guide](https://docs.stripe.com/terminal/references/react-native-migration-guide.md).

## Before you begin

Before installing the SDK, configure your app with the following requirements:

- React Native 0.83 or later with the New Architecture, and the React version required by your React Native release. React Native 0.83 requires React 19.2.
- Node.js 20.19.4 or later, with Babel and Metro versions aligned with your React Native release.
- For iOS, a deployment target of 16.0 or later, Xcode 16.1 or later, and CocoaPods 1.13 or later, excluding 1.15.0 and 1.15.1. When using Xcode 26.4 or later, use React Native 0.83.5 or later.
- For Android, `minSdkVersion` 26 or later, `compileSdkVersion` and `targetSdkVersion` 35 or later, and Kotlin Gradle Plugin 2.2.0 or later. Tap to Pay has additional [device requirements](https://docs.stripe.com/terminal/payments/setup-reader/tap-to-pay.md?platform=android#supported-devices).

See the SDK’s [requirements](https://github.com/stripe/stripe-terminal-react-native#requirements) for the supported toolchain configuration.

Getting started with the React Native SDK requires four steps:

1. [Install the SDK](https://docs.stripe.com/terminal/payments/setup-integration.md#install) in your app.
2. [Configure](https://docs.stripe.com/terminal/payments/setup-integration.md#configure) your app.
3. [Set up the connection token endpoint](https://docs.stripe.com/terminal/payments/setup-integration.md#connection-token) in your app and back end.
4. [Initialize the SDK](https://docs.stripe.com/terminal/payments/setup-integration.md#initialize) in your app.

> If you’re building an **Apps on Devices** integration (running your app on Stripe smart readers such as the T600 or S700/S710), you must also complete additional [native Android setup steps](https://docs.stripe.com/terminal/features/apps-on-devices/build.md?terminal-sdk-platform=react-native#setup-app) after following this guide.

## Install the SDK [Client-side]

The [React Native SDK](https://github.com/stripe/stripe-terminal-react-native) is open source and fully documented. Internally, it makes use of native iOS and Android SDKs. Install the SDK by running:

#### NPM

```bash
npm install @stripe/stripe-terminal-react-native
```

#### Yarn

```bash
yarn add @stripe/stripe-terminal-react-native
```

#### Expo

```bash
npx expo install @stripe/stripe-terminal-react-native
```

## Configure your app [Client-side]

#### React Native CLI

#### iOS

### Native dependencies 

React Native’s default template `Podfile` sets your deployment target with `platform :ios, min_ios_version_supported`, which can resolve to a version earlier than the 16.0 this SDK requires. If so, override it in `ios/Podfile`:

```ruby
platform :ios, '16.0'
```

Then install native dependencies by running `yarn ios`.

> Running `pod install` directly from the `ios` directory also works, but newer React Native versions print a deprecation notice recommending `yarn ios` instead, since React Native is moving away from invoking CocoaPods directly.

CocoaPods autolinks the React Native module, which resolves the native Stripe Terminal iOS SDK from its [Swift package](https://github.com/stripe/stripe-terminal-ios-spm) and embeds the framework automatically. Don’t add a separate `StripeTerminal` pod or Swift package dependency to your app.

### Permissions

To prepare your app to work with the Stripe Terminal SDK, make a few changes to your **Info.plist** file in Xcode.

1. Enable location services with the following key-value pair.

| Privacy – Location When In Use Usage Description |
| ------------------------------------------------ |
| **Key**                                          | [NSLocationWhenInUseUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nslocationwheninuseusagedescription) |
| **Value**                                        | **Location access is required to accept payments.**                                                                                                            |

   To reduce fraud risks associated with payments, and to minimize disputes, Stripe must know where payments occur. If the SDK can’t determine the location of the iOS device, payments are disabled until location access is restored.

2. Make sure that your app runs in the background and remains connected to mobile readers.

| Required background modes for mobile readers |
| -------------------------------------------- |
| **Key**                                      | [UIBackgroundModes](https://developer.apple.com/documentation/bundleresources/information_property_list/uibackgroundmodes) |
| **Value**                                    | **bluetooth-central** (Uses Bluetooth LE accessories)                                                                      |

   Setting the [bluetooth-central](https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW6) background mode lets the reader remain in standby mode when your app is running in the background, or when the iOS device is locked. Without this value, standby fails. When your app is running in the background, the reader can turn off automatically to conserve power.

3. Allow your app to display a Bluetooth permission dialog. The app store requires including this, even if your app doesn’t support connecting to mobile readers.

| Privacy - Bluetooth Always Usage Description |
| -------------------------------------------- |
| **Key**                                      | [NSBluetoothAlwaysUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/NSBluetoothAlwaysUsageDescription) |
| **Value**                                    | **This app uses Bluetooth to connect to supported card readers.**                                                                                          |

   iOS 13 introduced more specific permissions concerning an app’s use of Bluetooth peripherals. Apps that link with Core Bluetooth must include this key in their Info.plist file to prevent the app from crashing on its first launch.

   The SDK also checks for this key whenever you discover readers, regardless of the discovery method. If you only connect to internet readers, you still must add it, or discovery fails with an assertion.

4. Pass app validation checks when you submit it to the App Store. As of SDK version 3.4.0, this permission requirement is removed.

| Privacy – Bluetooth Peripheral Usage Description |
| ------------------------------------------------ |
| **Key**                                          | [NSBluetoothPeripheralUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbluetoothperipheralusagedescription) |
| **Value**                                        | **Connecting to supported card readers requires Bluetooth access.**                                                                                                |

   This is an example—you can rephrase the prompt for user permission in your app.

5. Save your app’s **Info.plist**. Now it’s configured correctly and ready for use with the Stripe Terminal SDK.

> If you’re using Tap to Pay on iPhone, you must [request and configure](https://developer.apple.com/documentation/proximityreader/setting-up-the-entitlement-for-tap-to-pay-on-iphone) the Tap to Pay on iPhone development entitlement from your Apple Developer account.

#### Android

### Kotlin compiler

Terminal Android SDK 6.0 requires Kotlin Gradle Plugin 2.2.0 or later. React Native’s default templates can use an older version (for example, React Native 0.85 uses Kotlin 2.1.20).  If needed, set both the version and the plugin dependency in your root `android/build.gradle`. Without this override, the build fails while compiling the SDK with errors such as `Module was compiled with an incompatible version of Kotlin`.

```groovy
buildscript {
    ext {
        kotlinVersion = "2.2.0"
    }
    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
    }
}
```

For React Native 0.83, use Gradle 9.0.0 and Android Gradle Plugin 8.12.0. For later React Native releases, follow that release’s template and keep the Kotlin override if its compiler is older than 2.2.0. Compiler plugins used by your app must also support the selected Kotlin version.

### Minimum SDK version

This SDK requires `minSdkVersion` 26 or later. If your project’s `minSdkVersion` is lower, raise it in your root `android/build.gradle`:

```groovy
buildscript {
    ext {
        minSdkVersion = 26
    }
}
```

### Permissions

The Stripe Terminal SDK requires the following Android runtime permissions to function properly:

| Runtime                               | Permissions                                                                                                                                                          |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Android 12 (API level 31) and later   | - `PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION`
  - `PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT`
  - `PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN` |
| Android 11 (API level 30) and earlier | `PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION`                                                                                                                |

Before initializing the Terminal SDK, use `requestNeededAndroidPermissions` to request the required permissions for the device’s Android version. Don’t request `ACCESS_FINE_LOCATION` yourself on Android 12 and later: the SDK’s manifest limits it to Android 11 and earlier, so the system can’t grant it there, and coarse location is sufficient. This helper can display native Android permission dialogs. The `accessFineLocation` option customizes the rationale dialog that Android can show before the location permission request, on all Android versions. Await the result and check `error` before initializing the SDK. If a required permission is denied, the helper returns an error without requesting the remaining permissions. Previously granted permissions don’t trigger another dialog:

```js
import { requestNeededAndroidPermissions } from '@stripe/stripe-terminal-react-native';

try {
  const { error } = await requestNeededAndroidPermissions({
    accessFineLocation: {
      title: 'Location Permission',
      message: 'Stripe Terminal needs access to your location',
      buttonPositive: 'Accept',
    },
  });
  if (!error) {
    // Initialize the SDK
  } else {
    console.error(
      'Location and BT services are required to connect to a reader.'
    );
  }
} catch (e) {
  console.error(e);
}
```

Alternatively, if you need granular control over permission requests, you can manually request each permission using `PermissionsAndroid.request`:

```js
import { PermissionsAndroid, Platform } from 'react-native';

// On Android 12 and later, request ACCESS_COARSE_LOCATION, BLUETOOTH_CONNECT, and BLUETOOTH_SCAN.
// On Android 11 and earlier, request ACCESS_FINE_LOCATION.
// This example shows the pattern for requesting one permission.
const granted = await PermissionsAndroid.request(
  Platform.OS === 'android' && Platform.Version >= 31
    ? PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION
    : PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
  {
    title: 'Location Permission',
    message: 'Stripe Terminal needs access to your location',
    buttonPositive: 'Accept',
  },
);

if (granted === PermissionsAndroid.RESULTS.GRANTED) {
  console.log('Location permission granted');
} else {
  console.error('Location permission denied');
}
```

### Manifest

To ensure compatibility with Android 12 and later, make sure to add `android:exported="true"` to `AndroidManifest.xml`:

```xml
<manifest ...>
    <application android:name=".MainApplication">
      <activity
        android:name=".MainActivity"
        android:exported="true">
          <!-- content -->
      </activity>
    </application>
</manifest>
```

For additional context on changes made in Android 12, see the [Android documentation about safer component exporting](https://developer.android.com/about/versions/12/behavior-changes-12#exported).

You don’t need to declare the SDK’s permissions in your app’s `AndroidManifest.xml`. The Terminal Android SDK’s manifest declares the Bluetooth, location, and network permissions it uses, and the Android build merges them into your app’s manifest.

#### Expo

> This package can’t be used in the “Expo Go” app because it requires [custom native code](https://docs.expo.io/workflow/customizing/). You must use `npx expo prebuild` to generate native projects and run your app using `npx expo run:ios` or `npx expo run:android`.

#### iOS

### Configuring the SDK

After [installing](https://docs.stripe.com/terminal/payments/setup-integration.md#install) the SDK, add the [configuration plugin](https://docs.expo.io/guides/config-plugins/) to the [plugins](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`.

> #### Include options during installation
> 
> `npx expo install` adds a `"@stripe/stripe-terminal-react-native"` entry without options, which makes the plugin fail with `TypeError: Cannot read properties of undefined (reading 'tapToPayCheck')`. Replace that entry with the following example.

Set the following configuration options, depending on your reader type:

- `localNetworkUsagePermission` - Required for smart readers using LAN connection
- `appDelegate` - Calls `TerminalApplicationDelegate.onCreate()` from `MainApplication` on Android. Required for every Android integration.
- `tapToPayCheck` - Skips initialization in `MainApplication` on Android while the app runs in the Tap to Pay on Android process. Required only if you support Tap to Pay on Android.

```json
{
  "expo": {
    "plugins": [
      [
        "@stripe/stripe-terminal-react-native",
        {
          "bluetoothBackgroundMode": true,
          "locationWhenInUsePermission": "Location access is required to accept payments.",
          "bluetoothPeripheralPermission": "Bluetooth access is required to connect to supported bluetooth card readers.",
          "bluetoothAlwaysUsagePermission": "This app uses Bluetooth to connect to supported card readers.",
          "localNetworkUsagePermission": "This app uses the local WiFi network to connect to supported card readers.",
          "appDelegate": true,
          "tapToPayCheck": true
        }
      ]
    ]
  }
}
```

### Build

Next, rebuild your app as described in the [Adding custom native code](https://docs.expo.io/workflow/customizing/) guide with:

```bash
npx expo prebuild
```

and then:

```bash
npx expo run:ios
```

This command installs the React Native module’s CocoaPods dependencies and configures the Terminal iOS Swift package automatically. Don’t add a separate `StripeTerminal` dependency.

> If you’re using Tap to Pay on iPhone, you must [request and configure](https://developer.apple.com/documentation/proximityreader/setting-up-the-entitlement-for-tap-to-pay-on-iphone) the Tap to Pay on iPhone development entitlement from your Apple Developer account.

#### Android

### Permissions

The Stripe Terminal SDK requires the following Android runtime permissions to function properly:

| Runtime                               | Permissions                                                                                                                                                          |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Android 12 (API level 31) and later   | - `PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION`
  - `PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT`
  - `PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN` |
| Android 11 (API level 30) and earlier | `PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION`                                                                                                                |

Before initializing the Terminal SDK, use `requestNeededAndroidPermissions` to request the required permissions for the device’s Android version. Don’t request `ACCESS_FINE_LOCATION` yourself on Android 12 and later: the SDK’s manifest limits it to Android 11 and earlier, so the system can’t grant it there, and coarse location is sufficient. This helper can display native Android permission dialogs. The `accessFineLocation` option customizes the rationale dialog that Android can show before the location permission request, on all Android versions. Await the result and check `error` before initializing the SDK. If a required permission is denied, the helper returns an error without requesting the remaining permissions. Previously granted permissions don’t trigger another dialog:

```js
import { requestNeededAndroidPermissions } from '@stripe/stripe-terminal-react-native';

try {
  const { error } = await requestNeededAndroidPermissions({
    accessFineLocation: {
      title: 'Location Permission',
      message: 'Stripe Terminal needs access to your location',
      buttonPositive: 'Accept',
    },
  });
  if (!error) {
    // Initialize the SDK
  } else {
    console.error(
      'Location and BT services are required to connect to a reader.'
    );
  }
} catch (e) {
  console.error(e);
}
```

Alternatively, if you need granular control over permission requests, you can manually request each permission using `PermissionsAndroid.request`:

```js
import { PermissionsAndroid, Platform } from 'react-native';

// On Android 12 and later, request ACCESS_COARSE_LOCATION, BLUETOOTH_CONNECT, and BLUETOOTH_SCAN.
// On Android 11 and earlier, request ACCESS_FINE_LOCATION.
// This example shows the pattern for requesting one permission.
const granted = await PermissionsAndroid.request(
  Platform.OS === 'android' && Platform.Version >= 31
    ? PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION
    : PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
  {
    title: 'Location Permission',
    message: 'Stripe Terminal needs access to your location',
    buttonPositive: 'Accept',
  },
);

if (granted === PermissionsAndroid.RESULTS.GRANTED) {
  console.log('Location permission granted');
} else {
  console.error('Location permission denied');
}
```

### Configuring the SDK

After [installing](https://docs.stripe.com/terminal/payments/setup-integration.md#install) the SDK, add the [configuration plugin](https://docs.expo.io/guides/config-plugins/) to the [plugins](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`.

> #### Include options during installation
> 
> `npx expo install` adds a `"@stripe/stripe-terminal-react-native"` entry without options, which makes the plugin fail with `TypeError: Cannot read properties of undefined (reading 'tapToPayCheck')`. Replace that entry with the following example.

Set the following configuration options, depending on your reader type:

- `localNetworkUsagePermission` - Required for smart readers using LAN connection
- `appDelegate` - Calls `TerminalApplicationDelegate.onCreate()` from `MainApplication` on Android. Required for every Android integration.
- `tapToPayCheck` - Skips initialization in `MainApplication` on Android while the app runs in the Tap to Pay on Android process. Required only if you support Tap to Pay on Android.

```json
{
  "expo": {
    "plugins": [
      [
        "@stripe/stripe-terminal-react-native",
        {
          "bluetoothBackgroundMode": true,
          "locationWhenInUsePermission": "Location access is required to accept payments.",
          "bluetoothPeripheralPermission": "Bluetooth access is required to connect to supported bluetooth card readers.",
          "bluetoothAlwaysUsagePermission": "This app uses Bluetooth to connect to supported card readers.",
          "localNetworkUsagePermission": "This app uses the local WiFi network to connect to supported card readers.",
          "appDelegate": true,
          "tapToPayCheck": true
        }
      ]
    ]
  }
}
```

### Android SDK version

The SDK requires `minSdkVersion` 26 or later. Expo’s [Prebuild](https://docs.expo.dev/workflow/prebuild/) can overwrite manual changes to `android/build.gradle` when regenerating your native project, such as when you run `npx expo prebuild --clean`. Use the [expo-build-properties](https://docs.expo.dev/versions/latest/sdk/build-properties/) config plugin instead:

```bash
npx expo install expo-build-properties
```

Add the following entry to the existing `expo.plugins` array in `app.json`. Keep the `@stripe/stripe-terminal-react-native` entry and its options:

```json
[
  "expo-build-properties",
  {
    "android": {
      "minSdkVersion": 26
    }
  }
]
```

### Kotlin compiler

Terminal Android SDK 6.0 requires Kotlin Gradle Plugin 2.2.0 or later. If your Expo SDK uses an older version, add a local config plugin that pins the Kotlin Gradle Plugin version:

```js
const { withProjectBuildGradle } = require('expo/config-plugins');

module.exports = function withKotlinGradlePlugin(config, version = '2.2.0') {
  return withProjectBuildGradle(config, (config) => {
    config.modResults.contents = config.modResults.contents.replace(
      /classpath\(['"]org\.jetbrains\.kotlin:kotlin-gradle-plugin(:[^'"]*)?['"]\)/,
      `classpath('org.jetbrains.kotlin:kotlin-gradle-plugin:${version}')`
    );
    return config;
  });
};
```

Then add `"./plugins/withKotlinGradlePlugin"` to the `expo.plugins` array in `app.json`.

> #### Kotlin version by Expo SDK
> 
> Expo SDK 58 (React Native 0.88) already uses Kotlin 2.2.0. Earlier SDKs, such as Expo SDK 56 (React Native 0.85), use Kotlin 2.1.20 and fail to compile the Terminal SDK with errors such as `Module was compiled with an incompatible version of Kotlin`. The plugin above is needed because `expo-build-properties`’s `kotlinVersion` option doesn’t take effect: the generated `android/build.gradle` doesn’t read it, and Prebuild overwrites manual edits to that file.

#### Build

Next, rebuild your app as described in the [Adding custom native code](https://docs.expo.io/workflow/customizing/) guide with:

```bash
npx expo prebuild
```

and then:

```bash
npx expo run:android
```

## Set up the connection token endpoint [Server-side] [Client-side]

### Server-side 

To connect to a reader, your back end needs to give the SDK permission to use the reader with your Stripe account, by providing it with the [secret](https://docs.stripe.com/api/terminal/connection_tokens/object.md#terminal_connection_token_object-secret) from a [ConnectionToken](https://docs.stripe.com/api/terminal/connection_tokens.md). Your back end needs to only create connection tokens for clients that it trusts.

```curl
# Create a server endpoint that creates a `ConnectionToken` and returns its
# `secret` to your app. The SDK uses this `secret` to connect to a reader.
curl -X POST https://api.stripe.com/v1/terminal/connection_tokens \
  -u "<<YOUR_SECRET_KEY>>:"
```

Obtain the secret from the `ConnectionToken` on your server and pass it to the client side.

#### Ruby

```ruby
post '/connection_token' do
  token = # ... Create or retrieve the ConnectionToken
  {secret: token.secret}.to_json
end
```

> The `secret` from the `ConnectionToken` lets you connect to any Stripe Terminal reader and take payments with your Stripe account. Be sure to authenticate the endpoint for creating connection tokens and protect it from cross-site request forgery (CSRF).

### Client-side 

To give the SDK access to this endpoint, create a token provider single function that requests a `ConnectionToken` from your back end.

```tsx
import { StripeTerminalProvider } from '@stripe/stripe-terminal-react-native';

const fetchTokenProvider = async () => {
  const response = await fetch(`{YOUR BACKEND URL}/connection_token`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
  });
  const { secret } = await response.json();
  return secret;
};
```

> If your back end runs on your development machine, the Android emulator can’t reach it at `localhost`. Use `10.0.2.2` instead, which the emulator maps to your host machine’s `localhost`.

This function is called whenever the SDK needs to authenticate with Stripe or the Reader. It’s also called when a new connection token is needed to connect to a reader (for example, when your app disconnects from a reader). If the SDK can’t retrieve a new connection token from your back end, connecting to a reader fails with the error from your server.

> Don’t cache or hardcode the connection token. The SDK manages the connection token’s lifecycle.

## Initialize the SDK [Client-side]

### Android

The Android SDK is lifecycle aware. To prevent memory leaks and ensure proper cleanup of long-running Terminal SDK processes, your app’s `MainApplication` must call `TerminalApplicationDelegate.onCreate()` to inform the SDK about lifecycle events.

```kotlin
import com.stripeterminalreactnative.TerminalApplicationDelegate

class MainApplication : Application(), ReactApplication {
    override fun onCreate() {
        super.onCreate()
        TerminalApplicationDelegate.onCreate(this)
    }
}
```

If you’re using Expo, use the `appDelegate` [configuration plugin](https://docs.stripe.com/terminal/payments/setup-integration.md#configure) option instead of editing `MainApplication.kt` directly, which makes this change for you.

> If you’re using Tap to Pay on Android, the initialization in `MainApplication` is slightly different from this example. See [Connect to a reader with Tap to Pay on Android](https://docs.stripe.com/terminal/payments/connect-reader.md?terminal-sdk-platform=react-native&reader-type=tap-to-pay#initialize).

Pass your [token provider](https://docs.stripe.com/terminal/payments/setup-integration.md#connection-token) and the required `localeConfig` to `StripeTerminalProvider`. The locale configuration controls API error message localization. Use `cardLanguagePreferenceIfAvailable` to use the cardholder’s preferred language when available, with the device locale as a fallback. To use a fixed locale, pass `{ type: 'hardcoded', locale: 'en-US' }`.

The SDK applies this configuration during initialization. Restart the app to change it for a subsequent session.

```tsx
import { StripeTerminalProvider } from '@stripe/stripe-terminal-react-native';

function Root() {
  const fetchTokenProvider = async () => {
    const response = await fetch(`${API_URL}/connection_token`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
    });
    const { secret } = await response.json();
    return secret;
  };

  return (
    <StripeTerminalProvider
      tokenProvider={fetchTokenProvider}
      localeConfig={{ type: 'cardLanguagePreferenceIfAvailable' }}
    >
      <App />
    </StripeTerminalProvider>
  );
}
```

As a last step, call the `initialize` method from `useStripeTerminal` hook.

> You must call the `initialize` method from a component nested within `StripeTerminalProvider`, not from the component that contains the `StripeTerminalProvider`.
> 
> After initialization completes, you can use other SDK methods such as `discoverReaders`, `connectReader`, and `processPaymentIntent`. If you attempt to call these methods before initialization, you’ll receive the following error: “First initialize the Stripe Terminal SDK before performing any action.”

```tsx
function App() {
  const { initialize } = useStripeTerminal();
  const [initError, setInitError] = useState<string>();

  const handleInitialize = useCallback(async () => {
    const { error } = await initialize();
    if (error) {
      setInitError(`${error.code}: ${error.message}`);
      return;
    }
    setInitError(undefined);
  }, [initialize]);

  useEffect(() => {
    handleInitialize();
  }, [handleInitialize]);

  if (initError) {
    return (
      <View>
        <Text>{initError}</Text>
        <Button title="Retry" onPress={handleInitialize} />
      </View>
    );
  }

  return <View />;
}
```

> `initialize` resolves to `{ error }` rather than throwing. A `CONNECTION_TOKEN_PROVIDER_ERROR` means your `tokenProvider` function failed, for example because the connection-token endpoint is unreachable. Fix the underlying issue and call `initialize` again to retry; the SDK doesn’t retry automatically.

## SDK updates

Before upgrading from `0.0.1-beta.33`, review the [migration guide](https://docs.stripe.com/terminal/references/react-native-migration-guide.md) for changes to capture behavior, response types, error handling, and reader callbacks.

Stripe periodically releases updates which can include new functionality, bug fixes, and security updates. Update your SDK as soon as a new version is available. The currently available SDKs are:

- [Stripe Terminal Android SDK](https://github.com/stripe/stripe-terminal-android/releases)
- [Stripe Terminal iOS SDK](https://github.com/stripe/stripe-terminal-ios/releases)
- [Stripe Terminal JavaScript SDK](https://docs.stripe.com/terminal/references/api/js-sdk.md#changelog)
- [Stripe Terminal React Native SDK](https://github.com/stripe/stripe-terminal-react-native)

## Next steps

- [Connect to a reader](https://docs.stripe.com/terminal/payments/connect-reader.md?terminal-sdk-platform=react-native&reader-type=internet)

