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 (iOS 15+ required for StoreKit 2 features)
- Android API level 21+ for Android apps
Package Installation
Install the package using your favorite package manager:
npm install expo-iap
Important for Expo Managed Workflow
If you're using the Expo managed workflow, you must use a custom development client since in-app purchases require native modules that aren't available in Expo Go.
After installing the package, you need to:
-
Configure expo-build-properties for Android (required for Kotlin 2.0+ support):
Starting from version 2.7, expo-iap supports Google Play Billing Library v8, which requires Kotlin 2.0+. Since
expo-modules-core
doesn't support Kotlin 2.0 yet, you need to manually configure the Kotlin version.Add the following to your
app.json
:{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"android": {
"kotlinVersion": "2.0.21"
}
}
]
]
}
} -
Install the plugin and run prebuild:
npx expo prebuild --clean
This will generate the native iOS and Android directories with the necessary configurations. Learn more about adopting prebuild.
-
Create a development build (see the Platform Configuration section below for details)
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 EAS CLI (if not already installed):
npm install -g eas-cli
-
Create a development build:
eas build --platform ios --profile development
eas build --platform android --profile development
For React Native CLI Projects
If you're using React Native CLI projects, you'll need to install expo-modules-core first:
npx install-expo-modules@latest
Learn more about installing Expo modules in existing React Native projects.
Then 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
Important: Starting from version 2.7, expo-iap supports Google Play Billing Library v8, which requires Kotlin 2.0+. Since expo-modules-core
doesn't support Kotlin 2.0 yet, you need to configure your project with expo-build-properties
.
Add the following to your app.json
:
{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"android": {
"kotlinVersion": "2.0.21"
}
}
]
]
}
}
After adding this configuration, run:
npx expo prebuild --clean
This configuration ensures compatibility with Google Play Billing Library v8.0.0.
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.