Installation
This guide will help you install and configure Expo IAP in your React Native or Expo project.
Prerequisites
Before installing Expo IAP, make sure you have:
- React Native 0.64 or later, or Expo SDK 45 or later
- Node.js 16 or later
- iOS 12+ for iOS apps
- Android API level 21+ for Android apps
Package Installation
Install the package using your favorite package manager:
npm install expo-iap
Platform Configuration
For Expo Managed Workflow
If you're using Expo managed workflow, you'll need to create a custom development client since in-app purchases require native modules that aren't available in Expo Go.
-
Install Expo CLI (if not already installed):
npm install -g @expo/cli
-
Create a development build:
eas build --platform ios --profile development
eas build --platform android --profile development
For Expo Bare Workflow
If you're using Expo bare workflow or vanilla React Native, you'll need to install the native dependencies:
iOS
-
Install pods:
cd ios && pod install
-
Add StoreKit capability to your iOS app in Xcode:
- Open your project in Xcode
- Select your app target
- Go to "Signing & Capabilities"
- Click "+ Capability" and add "In-App Purchase"
Android
No additional configuration needed for Android. The Google Play Billing library is automatically linked.
Configuration
App Store Connect (iOS)
Before you can use in-app purchases on iOS, you need to set up your products in App Store Connect:
- Sign in to App Store Connect
- Navigate to your app
- Go to "Features" > "In-App Purchases"
- Create your products with unique product IDs
Google Play Console (Android)
For Android, set up your products in Google Play Console:
- Sign in to Google Play Console
- Navigate to your app
- Go to "Monetize" > "Products" > "In-app products"
- Create your products with unique product IDs
Verification
To verify that Expo IAP is properly installed, create a simple test:
import {useIAP} from 'expo-iap';
function TestComponent() {
const {connected} = useIAP();
console.log('IAP Connection status:', connected);
return null;
}
If everything is set up correctly, you should see the connection status logged in your console.
Next Steps
Now that you have Expo IAP installed, you can:
Troubleshooting
If you encounter issues during installation:
-
Clear node_modules and reinstall:
rm -rf node_modules
npm install -
For iOS, clean and rebuild pods:
cd ios
rm -rf Pods Podfile.lock
pod installFor Expo projects, use prebuild instead:
npx expo prebuild --clean
-
For React Native, reset Metro cache:
npx react-native start --reset-cache
For more help, check our Troubleshooting Guide or open an issue on GitHub.