What is react-native-iap (in simple words)?
react-native-iap is basically the bridge between your JavaScript code and the native in-app purchase systems on:
- iOS (StoreKit)
- Android (Google Play Billing)
Instead of writing native code, you get a clean JS API where you can:
- Fetch product info
- Start a purchase flow
- Handle purchase results
- Restore access
- Validate receipts
All from React Native.
It’s not perfect, but it saves you weeks of dealing with native complexities.
Why you’ll actually want to use this library
Most blogs stop at “it’s cross-platform,” but here’s the real-world value:
1. One codebase, fewer headaches
If you’ve ever tried doing IAP separately on Android and iOS… bro… no.
react-native-iap handles the differences for you.
2. Great for both simple and advanced apps
Whether you just want a one-time “Remove Ads” button or a full subscription system, it handles both.
3. Nitro Modules = performance
The newer versions use “Nitro Modules,” meaning the bridge overhead is minimal.
4. Solid community examples
If you get stuck, someone on GitHub or StackOverflow has probably already faced the same issue.
You can check official package here
Before You Start — Practical Things Nobody Tells You
Here’s where the real developer experience comes in:
You MUST create products in Google Play Console and App Store Connect first
Otherwise your app will throw errors like:
“Product not recognized”
The library is fine — your store setup isn’t.
Prices and product descriptions do NOT come from your code
They come from the store.
Your app only requests them.
Testing never works perfectly on emulators
Use real devices.
Especially on iOS.
Subscriptions are the most confusing part
Not because of the library —
because Apple and Google validate them differently.
Always implement “Restore Purchases”
iOS users expect it.
If you skip it, you’ll get complaints.
Fast.
How to Set Up react-native-iap (Practical Guide)
Step 1: Install the library
npm install react-native-iap react-native-nitro-modules
Then install pods if you’re on macOS:
cd ios && pod install
Step 2: Enable native capabilities
iOS
- Open Xcode
- Go to Signing & Capabilities
- Add: In-App Purchases
Android
- Ensure Google Play Billing is enabled in your Play Console app
- Add a testing account
Step 3: Initialize IAP early
Here’s a pattern that works in real apps:
import { initConnection, endConnection } from 'react-native-iap';
import { useEffect } from 'react';
export default function App() {
useEffect(() => {
initConnection().catch(() => {
console.warn("IAP connection failed");
});
return () => {
endConnection();
};
}, []);
return <YourApp />;
}
Step 4: Fetch your products
Use the exact product IDs from your store dashboards:
import { getProducts } from 'react-native-iap';
const itemIds = ["premium_upgrade", "donation_10", "pro_subscription"];
const products = await getProducts({ skus: itemIds });
console.log(products);
Step 5: Purchase flow
import { requestPurchase } from 'react-native-iap';
const buyPremium = async () => {
try {
await requestPurchase({
sku: "premium_upgrade",
});
} catch (err) {
console.log("purchase error", err);
}
};
Step 6: Listen for purchase updates
This is where many beginners struggle.
You MUST acknowledge purchases, or Google cancels them.
import { purchaseUpdatedListener, finishTransaction } from 'react-native-iap';
useEffect(() => {
const subscription = purchaseUpdatedListener(async (purchase) => {
console.log("Purchase received", purchase);
// Always finish the transaction
await finishTransaction({ purchase, isConsumable: false });
});
return () => subscription.remove();
}, []);
Real-World Tips From Developers
🔸 Avoid doing logic inside the purchase listener
Move everything into a function.
It gets chaotic otherwise.
🔸 Keep product IDs consistent
Many people fail because of typos like:
- “premium” in code
- “premium_item” in Play Store
Both platforms must match exactly.
🔸 Don’t trust the client for validation
If you’re selling subscriptions or high-value features:
⬆️ Add server-side validation.
🔸 Build a proper “Purchase Successful” UI
Users love feedback.
Bad UX reduces revenue.
Should you use react-native-iap? (Honest Opinion)
If you’re building:
- a notes app with premium features
- a fitness app with premium content
- a game with coins or lives
- a chat app with subscriptions
Then yes, react-native-iap is the right tool.
It’s powerful, stable, flexible… and battle-tested.
If you’re building something enterprise or huge-scale, consider pairing it with a backend service for receipts — but the library is still your foundation.