stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

'StripeSdk' could not be found

Open Aniket239 opened this issue 6 months ago • 17 comments

Describe the bug I have installed the Stripe SDK using npm install @stripe/stripe-react-native but i am getting

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'StripeSdk' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes Error Component Stack:

Code import { STRIPE_PUBLISHABLE_KEY } from '@env'; import { StripeProvider } from '@stripe/stripe-react-native'; <StripeProvider publishableKey={STRIPE_PUBLISHABLE_KEY} merchantIdentifier="merchant.identifier" // required for Apple Pay urlScheme="your-url-scheme" // required for 3D Secure and bank redirects

<PaymentScreen />

// PaymentScreen.ts import { useStripe } from '@stripe/stripe-react-native'; import { useEffect } from 'react'; import { View, Button } from 'react-native';

export default function PaymentScreen() { const { initPaymentSheet, presentPaymentSheet } = useStripe();

const setup = async () => {
    const { error } = await initPaymentSheet({
        merchantDisplayName: 'Example, Inc.',
        paymentIntentClientSecret: '', // retrieve this from your server
    });
    if (error) {
        // handle error
    }
};

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

const checkout = async () => {
    const { error } = await presentPaymentSheet();

    if (error) {
        // handle error
    } else {
        // success
    }
};

return (
    <View>
        <Button title="Checkout" onPress={checkout} />
    </View>
);

}

To Reproduce Steps to reproduce the behavior:

  1. Go to install Stripe SDK
  2. Add the Stripe provider
  3. Run the project
  4. See error

Expected behavior Run the app and open the Stripe payment gateway

Specifications System: OS: Windows 11 10.0.26100 CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz Memory: 1.86 GB / 15.83 GB Binaries: Node: version: 20.18.0 path: C:\Program Files\nodejs\node.EXE Yarn: version: 1.22.22 path: ~\AppData\Roaming\npm\yarn.CMD npm: version: 11.2.0 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels: - "31" - "33" - "34" - "35" Build Tools: - 34.0.0 - 35.0.0 System Images: - android-34 | Intel x86_64 Atom - android-34 | Google APIs ARM 64 v8a - android-34 | Google APIs Intel x86_64 Atom - android-34 | Google Play Intel x86_64 Atom - android-35 | Google Play Intel x86_64 Atom - android-35 | Pre-Release 16 KB Page Size Google APIs Intel x86_64 Atom - android-36 | Google Play Intel x86_64 Atom - android-36 | Pre-Release 16 KB Page Size Google Play Intel x86_64 Atom - android-UpsideDownCakePrivacySandbox | Google Play Intel x86_64 Atom Android NDK: Not Found Windows SDK: AllowDevelopmentWithoutDevLicense: Enabled IDEs: Android Studio: AI-243.26053.27.2432.13536105 Visual Studio: Not Found Languages: Java: 17.0.12 Ruby: Not Found npmPackages: "@react-native-community/cli": installed: 18.0.0 wanted: 18.0.0 react: installed: 19.0.0 wanted: 19.0.0 react-native: installed: 0.79.2 wanted: 0.79.2 react-native-windows: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: Not found newArchEnabled: Not found

Full error message Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'StripeSdk' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes Error Component Stack: at Subscription (Subscription.tsx:87:73) at StaticContainer (StaticContainer.js:9:15) at EnsureSingleNavigator (EnsureSingleNavigator.js:12:11) at SceneView (SceneView.js:15:9) at RCTView () at View (View.js:32:34) at RCTView () at View (View.js:32:34) at RCTView () at View (View.js:32:34) at CardSheet (CardSheet.js:11:10) at RCTView () at View (View.js:32:34) at Animated(View) (createAnimatedComponent.js:67:57) at PanGestureHandler (createHandler.tsx:197:51) at PanGestureHandler (GestureHandlerNative.js:8:34) at RCTView () at View (View.js:32:34) at Animated(View) (createAnimatedComponent.js:67:57) at RCTView () at View (View.js:32:34) at Card (Card.js:31:18) at CardContainerInner (CardContainer.js:13:21) at RNSScreen () at Animated(Anonymous) (createAnimatedComponent.js:67:57) at Suspender (index.tsx:6:9) at Suspense () at Freeze (index.tsx:24:32) at DelayedFreeze (DelayedFreeze.tsx:11:32) at InnerScreen (Screen.tsx:62:34) at Screen (Screen.tsx:290:41) at MaybeScreen (Screens.js:27:10) at RNSScreenContainer () at ScreenContainer (ScreenContainer.tsx:13:70) at MaybeScreenContainer (Screens.js:13:10) at RCTView () at View (View.js:32:34) at CardStack (CardStack.js:204:22) at RNCSafeAreaProvider () at SafeAreaProvider (SafeAreaContext.tsx:35:11) at SafeAreaProviderCompat (SafeAreaProviderCompat.js:30:11) at RNGestureHandlerRootView () at GestureHandlerRootView (GestureHandlerRootView.android.tsx:12:8) at StackView (StackView.js:20:23) at PreventRemoveProvider (PreventRemoveProvider.js:31:11) at NavigationContent (useComponent.js:6:9) at anonymous (useComponent.js:22:13) at StackNavigator (createStackNavigator.js:8:5) at ThemeProvider (ThemeProvider.js:7:8) at EnsureSingleNavigator (EnsureSingleNavigator.js:12:11) at BaseNavigationContainer (BaseNavigationContainer.js:72:15) at NavigationContainerInner (NavigationContainer.js:42:9) at RCTView () at View (View.js:32:34) at Index (Index.tsx:23:61) at ToastProvider (ToastContext.tsx:35:41) at ThemeProvider (ThemeContext.tsx:18:71) at Provider (react-redux.legacy-esm.js:910:66) at App () at RCTView () at View (View.js:32:34) at RCTView () at View (View.js:32:34) at AppContainer (AppContainer-dev.js:88:11) at MetricDash(RootComponent) (getCachedComponentWithDebugName.js:26:42) anonymous @ console.js:654 overrideMethod @ backend.js:17042 reactConsoleErrorHandler @ ExceptionsManager.js:182 anonymous @ setUpDeveloperTools.js:40 registerError @ LogBox.js:231 anonymous @ LogBox.js:80 reportException @ ExceptionsManager.js:111 handleException @ ExceptionsManager.js:171 handleError @ setUpErrorHandling.js:25 reportFatalError @ error-guard.js:49 guardedLoadModule @ require.js:179 metroRequire @ require.js:92 Subscription @ Subscription.tsx:215 reactStackBottomFrame @ ReactFabric-dev.js:14768 renderWithHooks @ ReactFabric-dev.js:4581 updateFunctionComponent @ ReactFabric-dev.js:6959 beginWork @ ReactFabric-dev.js:8215 runWithFiberInDEV @ ReactFabric-dev.js:571 performUnitOfWork @ ReactFabric-dev.js:12184 workLoopSync @ ReactFabric-dev.js:12010 renderRootSync @ ReactFabric-dev.js:11990 performWorkOnRoot @ ReactFabric-dev.js:11478 performSyncWorkOnRoot @ ReactFabric-dev.js:2822 flushSyncWorkAcrossRoots_impl @ ReactFabric-dev.js:2689 processRootScheduleInMicrotask @ ReactFabric-dev.js:2717 anonymous @ ReactFabric-dev.js:2839 Show 25 more frames Show less Subscription.tsx:215 Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'StripeSdk' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes Error Component Stack: at Subscription (Subscription.tsx:87:73) at StaticContainer (StaticContainer.js:9:15) at EnsureSingleNavigator (EnsureSingleNavigator.js:12:11) at SceneView (SceneView.js:15:9) at RCTView () at View (View.js:32:34) at RCTView () at View (View.js:32:34) at RCTView () at View (View.js:32:34) at CardSheet (CardSheet.js:11:10) at RCTView () at View (View.js:32:34) at Animated(View) (createAnimatedComponent.js:67:57) at PanGestureHandler (createHandler.tsx:197:51) at PanGestureHandler (GestureHandlerNative.js:8:34) at RCTView () at View (View.js:32:34) at Animated(View) (createAnimatedComponent.js:67:57) at RCTView () at View (View.js:32:34) at Card (Card.js:31:18) at CardContainerInner (CardContainer.js:13:21) at RNSScreen () at Animated(Anonymous) (createAnimatedComponent.js:67:57) at Suspender (index.tsx:6:9) at Suspense () at Freeze (index.tsx:24:32) at DelayedFreeze (DelayedFreeze.tsx:11:32) at InnerScreen (Screen.tsx:62:34) at Screen (Screen.tsx:290:41) at MaybeScreen (Screens.js:27:10) at RNSScreenContainer () at ScreenContainer (ScreenContainer.tsx:13:70) at MaybeScreenContainer (Screens.js:13:10) at RCTView () at View (View.js:32:34) at CardStack (CardStack.js:204:22) at RNCSafeAreaProvider () at SafeAreaProvider (SafeAreaContext.tsx:35:11) at SafeAreaProviderCompat (SafeAreaProviderCompat.js:30:11) at RNGestureHandlerRootView () at GestureHandlerRootView (GestureHandlerRootView.android.tsx:12:8) at StackView (StackView.js:20:23) at PreventRemoveProvider (PreventRemoveProvider.js:31:11) at NavigationContent (useComponent.js:6:9) at anonymous (useComponent.js:22:13) at StackNavigator (createStackNavigator.js:8:5) at ThemeProvider (ThemeProvider.js:7:8) at EnsureSingleNavigator (EnsureSingleNavigator.js:12:11) at BaseNavigationContainer (BaseNavigationContainer.js:72:15) at NavigationContainerInner (NavigationContainer.js:42:9) at RCTView () at View (View.js:32:34) at Index (Index.tsx:23:61) at ToastProvider (ToastContext.tsx:35:41) at ThemeProvider (ThemeContext.tsx:18:71) at Provider (react-redux.legacy-esm.js:910:66) at App () at RCTView () at View (View.js:32:34) at RCTView () at View (View.js:32:34) at AppContainer (AppContainer-dev.js:88:11) at MetricDash(RootComponent) (getCachedComponentWithDebugName.js:26:42) anonymous @ console.js:654 overrideMethod @ backend.js:17042 reactConsoleErrorHandler @ ExceptionsManager.js:182 anonymous @ setUpDeveloperTools.js:40 registerError @ LogBox.js:231 anonymous @ LogBox.js:80 reportException @ ExceptionsManager.js:111 handleException @ ExceptionsManager.js:171 handleError @ setUpErrorHandling.js:25 reportFatalError @ error-guard.js:49 guardedLoadModule @ require.js:179 metroRequire @ require.js:92 Subscription @ Subscription.tsx:215 reactStackBottomFrame @ ReactFabric-dev.js:14768 renderWithHooks @ ReactFabric-dev.js:4581 updateFunctionComponent @ ReactFabric-dev.js:6959 beginWork @ ReactFabric-dev.js:8215 runWithFiberInDEV @ ReactFabric-dev.js:571 performUnitOfWork @ ReactFabric-dev.js:12184 workLoopSync @ ReactFabric-dev.js:12010 renderRootSync @ ReactFabric-dev.js:11990 performWorkOnRoot @ ReactFabric-dev.js:11521 performSyncWorkOnRoot @ ReactFabric-dev.js:2822 flushSyncWorkAcrossRoots_impl @ ReactFabric-dev.js:2689 processRootScheduleInMicrotask @ ReactFabric-dev.js:2717 anonymous @ ReactFabric-dev.js:2839 Show 25 more frames Show less console.js:654 Warning: TypeError: Cannot read property 'StripeProvider' of undefined

This error is located at: at Subscription (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:171228:41) at StaticContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:155077:17) at EnsureSingleNavigator (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:150695:24) at SceneView (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:154917:22) at RCTView () at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:52158:43) at RCTView () at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:52158:43) at RCTView () at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:52158:43) at CardSheet (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:194829:23) at RCTView () at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:52158:43) at Animated(View) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:61639:47) at PanGestureHandler (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:173989:38) at PanGestureHandler (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:190502:34) at RCTView () at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:52158:43) at Animated(View) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:61639:47) at RCTView () at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:52158:43) at Card (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:194346:36) at CardContainerInner (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:193960:34) at RNSScreen () at Animated(Anonymous) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:61639:47) at Suspender (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:192952:22) at Suspense () at Freeze (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:192962:23) at DelayedFreeze (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:192917:22) at InnerScreen (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.metricdash&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server:192711:41) at Screen (http://localhost:8081/index.b

Aniket239 avatar Jun 02 '25 07:06 Aniket239

Are you using EAS build? If that's the case, you have to rebuild the app. You probably changed the app.json or app.config.ts so the app needs to be rebuilt for this config to work.

anacicconi avatar Jun 04 '25 14:06 anacicconi

I'm encountering the same issue now too, I tried rebuilding and removing node modules but nothing helps.

thedev132 avatar Jun 09 '25 00:06 thedev132

Hi @Aniket239 did you run run pod install in your ios directory to install the native dependencies?

seanzhang-stripe avatar Jun 10 '25 19:06 seanzhang-stripe

Even after using pod install I receive this error in the console:

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'StripeSdk' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes

Hope that helps :)

thedev132 avatar Jun 10 '25 19:06 thedev132

I'm seeing the same issue too with "expo": "~53.0.11" and "@stripe/stripe-react-native": "0.45.0". I'm using expo run:ios with a development build, ios project is building successfully, but seeing the above runtime error when the app launches.

Update: I deleted Podfile.lock and re-ran expo run:ios and everything works as expected.

jasonaibrahim avatar Jun 22 '25 15:06 jasonaibrahim

Thanks @jasonaibrahim for the solution.

@thedev132 can you try the same (i.e., delete Podfile.lock and re-run expo run:ios) and see if it solves your problem?

seanzhang-stripe avatar Jun 24 '25 07:06 seanzhang-stripe

I also run into the same problem. I'm using the react native cli and the issues started occurring to me after i've upgraded to the latest stripe version and react native 0.79.4 Weirdly enough, this error will only show after closing and re-opening the app which is using the sdk - but it's consistent in dev and release mode.

Ritorna avatar Jun 26 '25 09:06 Ritorna

In my case i figured that in my MainActivity i've passed null to the inherited onCreate function, as it did cause issues in previous react native version.

As for now, it seems to work flawless. I would need to dig deeper to fully understand, whether this is now required in order to make turbo modules work or not.

 override fun onCreate(savedInstanceState: Bundle?) {
    SplashScreen.show(this);
    super.onCreate(savedInstanceState); // <=  pass the savedInstanceState as it now is correctly persisted
  }

Ritorna avatar Jun 30 '25 09:06 Ritorna

hey guys, also seeing this error running npx expo run:ios with "@stripe/stripe-react-native": "^0.49.0",

Any idea how to resolve this?

hugoth avatar Jul 06 '25 13:07 hugoth

@hugoth did you try deleting Podfile.lock and re-run expo run:ios?

jasonaibrahim avatar Jul 06 '25 13:07 jasonaibrahim

@jasonaibrahim yes just did same result :( here my app.config plugin's file

    plugins: [
      "@react-native-google-signin/google-signin",
      [
        "expo-build-properties",
        {
          ios: {
            useFrameworks: "static",
          },
        },
      ],
      "expo-router",
      "@react-native-firebase/app",
      "@react-native-firebase/auth",
      [
        "@stripe/stripe-react-native",
        {
          merchantIdentifier: "merchant.com.xxxxxx",
          enableGooglePay: true, // Enable Google Pay
        },
      ],
    ],

also cleared different expo's cache and node modules

hugoth avatar Jul 06 '25 14:07 hugoth

Are you using eas build? Is it possible to delete the ios/ and android/ directories and try again?

jasonaibrahim avatar Jul 06 '25 14:07 jasonaibrahim

@jasonaibrahim yes still have the same issue with eas build and after deleting ios/ and android/ directories

hugoth avatar Jul 06 '25 14:07 hugoth

Try deleting the installed app from the emulator or mobile device and then reinstalling it.

Aniket239 avatar Jul 06 '25 15:07 Aniket239

Update: running eas build fixed it, the error is still triggered on simulator when app launches, but once I close and reopen it, it works fine

hugoth avatar Jul 06 '25 22:07 hugoth

I'm also running into this issue, what's worked for me is to run expo prebuild, followed by opening the app in xcode and launching it from there in production mode.

Any attempt to launch in development mode gives me the above error.

It's not an ideal fix because it's quite a bit slower and dosen't auto refresh on updates, but at least it's something

sjuery avatar Aug 07 '25 16:08 sjuery

Also running into this issue, following to see what the resolution will be

Tzinov15 avatar Sep 24 '25 19:09 Tzinov15