StripeModule.init throws undefined is not an object

Please provide the following:

  1. SDK Version: 37.0.8
  2. Platforms(Android/iOS/web/all): iOS simulator, in-Expo

Hey everyone, I have set up the Stripe test payment flow. For that, I have created a page.
I have the import { PaymentsStripe as Stripe } from ‘expo-payments-stripe’ placed in the file header.

In the useEffect declaration, I put

useEffect(() => {
        Stripe.setOptionsAsync({
            publishableKey: 'pk_test_yadiyadiyada',
            androidPayMode: 'test',
            merchantId: 'your_merchant_id', // left as is for now
        });
    }, []);

This works great on Android, but it does not work for me on iOS simulator.
undefined is not an object (evaluating 'StripeModule.init')

What am I missing to make it up and running on the iOS simulator?

I found an issue where the author mentioned that expo-payments-stripe does not work on management flow

But why it works on Android via Expo client and does not work via Expo client on iOS?

Hey @unit37akasrd,

https://docs.expo.io/versions/v38.0.0/sdk/payments/ As the note at the top of the documentation indicates, the set up has already been configured for the Android version of the Expo client.

As for iOS, Apple is very strict on having the payments module included in an app and there has to be a clear and purposeful reason for its inclusion. To include it simply to test/develop the module is not allowed which is why you can not use it on iOS with a Managed project.

Cheers,
Adam

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.