Horizon OS
This guide covers setting up expo-iap for Meta Quest devices running Horizon OS.
Horizon OS uses Meta's Platform SDK for in-app purchases instead of Google Play Billing, but expo-iap handles all the platform differences for you.
Prerequisites & Setup
For detailed setup instructions including creating your Meta Quest app, configuring IAP products, and obtaining your Horizon App ID, please refer to:
OpenIAP Horizon OS Setup Guide
Once you have your Horizon App ID ready, continue with the Expo configuration below.
Configuration
1. Enable Horizon Mode
Add the Horizon configuration to your app.config.ts (or app.json):
export default {
expo: {
// ... other config
plugins: [
[
'expo-iap',
{
modules: {
horizon: true, // Enable Horizon OS support
},
android: {
horizonAppId: 'YOUR_HORIZON_APP_ID', // Required: Your Horizon App ID
},
},
],
],
},
};
2. Rebuild Your App
After adding the configuration, rebuild your Android project:
npx expo prebuild --clean --platform android
This will:
- Set
horizonEnabled=trueingradle.properties - Use
openiap-google-horizonartifact instead ofopeniap-google - Add Horizon Platform SDK dependencies
- Configure the app with your Horizon App ID
Platform Detection
Best Practice: Design your app to work seamlessly on both standard Android and Horizon OS without runtime detection. expo-iap automatically handles the platform differences when Horizon mode is enabled in your configuration.
If you need to conditionally enable features for Horizon OS, configure them at build time using your app.config.ts rather than runtime detection.
Testing
Installing Test Builds
# Build and install on Quest device
npx expo run:android --device
Or using ADB:
# Install APK on Quest device
adb install -r app-debug.apk
# View logs
adb logcat | grep ExpoIap
Troubleshooting
For expo-iap specific issues:
- Verify
horizon.appIdis correctly set in your app.config.ts - Run
npx expo prebuild --cleanto regenerate native projects - Check logs with
adb logcat | grep ExpoIap