is it possible to implement app-in purchase with out ejecting from expo

is it possible to implement app-in purchase in iOS, with out ejecting from expo, since we have deprecated ‘expo-in-app-purchases’ package ,can you please give the way if it is, please

Hi @satyam.ypo

Yes. As the documentation for expo-in-app-purchases says:

Deprecated: This module is no longer maintained and will be removed in a future SDK release. Development was paused in June 2022 and the package was deprecated in August 2023. We recommend one of the following, both of which are compatible with EAS Build and development builds:

react-native-iap, which provides an interface to client-side Google Play Billing and StoreKit API’s
react-native-purchases, which also integrates with RevenueCat’s services for server-side receipt validation and more.

You will not need to “eject”. The only thing is you will not be able to use the Expo Go app.

Instead, you will need to create a development build of your app using eas build --profile development and then use that instead of the Expo Go app.

thank you very much for your reply,

react-native-iap i am able to get react native cli examples only, can please give expo support example for listing of subscriptions for apple account, and purchase of subscription in ios platform simple example , if possible support of sdk 47,48,49

react-native-iap has a config plugin. This allows it to work in an Expo app in the managed workflow.

The installation should go basically according to the Getting started guide, but there are some things that you can skip because of the config plugin.

i.e., you should not need to run pod install or edit the android/build.gradle or android/app/build.gradle. Also ignore the “Manual installation” section.

I have not tried this package myself, but it should work like this:

First install the package. You could use npm, yarn or pnpm, depending on which you use, or if you use npx expo install react-native-iap then it should use the correct tool to install it.

Then you’ll need to add the config plugin to app.json as mentioned here:

Then build using eas build -p android --profile preview (or -p ios)

Hi
thank you very much for your reply,

i am fallowing react-native-iap package, and createad a development build also(not in expo go),
this is below code,

import * as RNIap from ‘react-native-iap’;

const iapConfig = {
// Add your subscription product identifiers here
subscriptionIds: Platform.select({
ios: [‘xxxxxxxxxxxxxxx’],
android: [‘xxxxxxxxxxxxxxx’],
}),
};

try {
await RNIap.initConnection();
await RNIap.initIap();
const availablePurchases = await RNIap.getSubscriptions();
console.log(‘Available Purchases:’, availablePurchases);

    // Fetch subscription products using configured identifiers
    const subscriptionProducts = await RNIap.getSubscriptions(iapConfig.subscriptionIds);
    setSubscriptions(subscriptionProducts);
  } catch (error) {
       console.error('Failed to initialize IAP:', error);
  }

while testing i am getting the fallowing error,

ERROR Failed to initialize IAP: [TypeError: RNIap.initIap is not a function (it is undefined)]

can you please help me on this

Great!

I do not see any reference to initIap in the react-native-iap repository. I suggest you read their documentation to see how to use it and maybe contact them if something doesn’t work.