Skip to content

Commit f1cc823

Browse files
committed
docs: organize getting-started
1 parent 72233be commit f1cc823

File tree

6 files changed

+154
-244
lines changed

6 files changed

+154
-244
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
import AdFitTopFixed from "@site/src/uis/AdFitTopFixed";
6+
7+
# Installation
8+
9+
<AdFitTopFixed />
10+
11+
This guide will help you install and configure React Native IAP in your React Native or Expo project.
12+
13+
:::warning Compatibility (Nitro 14.x)
14+
15+
- `[email protected]` is Nitro-based and requires **React Native 0.79+**.
16+
- If you must stay on **RN 0.75.x or lower**, install the last pre‑Nitro version: `npm i [email protected]`.
17+
- Hitting Swift 6 C++ interop errors in Nitro (e.g. `AnyMap.swift` using `cppPart.pointee.*`)? Pin Swift 5.10 for the `NitroModules` pod (see snippet below) as a temporary workaround.
18+
- Recommended path: Upgrade to RN 0.79+, update `react-native-nitro-modules` and `nitro-codegen` to latest, then `pod install` and do a clean build.
19+
- If you're using React Native version 0.78 or using Expo, consider using [expo-iap](https://expo-iap.hyo.dev/docs/installation) instead (easier configuration by installing `expo-modules-core` first).
20+
21+
If issues persist after upgrading or applying the Swift pin, please share a minimal repro (fresh app + `package.json` + `Podfile`). :::
22+
23+
## Prerequisites
24+
25+
Before installing React Native IAP, make sure you have:
26+
27+
- For `[email protected]` (Nitro): **React Native 0.79+** (Expo SDK aligned with RN 0.79)
28+
- For older RN (0.75.x or lower): use `[email protected]` (pre‑Nitro)
29+
- Node.js 16 or later
30+
- iOS 15+ for iOS apps (StoreKit 2 requirement)
31+
- Android API level 21+ for Android apps
32+
33+
## Package Installation
34+
35+
Install the package using your favorite package manager:
36+
37+
```bash
38+
npm install react-native-iap react-native-nitro-modules
39+
```
40+
41+
### For React Native CLI Projects
42+
43+
If you're using React Native CLI (not Expo), you need to install iOS dependencies after installing the package:
44+
45+
```bash
46+
cd ios && pod install
47+
```
48+
49+
The native modules will be automatically linked during your app's build process.
50+
51+
## Expo Configuration
52+
53+
### Important for Expo Managed Workflow
54+
55+
If you're using the Expo managed workflow, you **must** use a [custom development client](https://docs.expo.dev/versions/latest/sdk/dev-client/) since in-app purchases require native modules that aren't available in Expo Go.
56+
57+
After installing the package, you need to:
58+
59+
1. **Configure expo-build-properties for Android** (required for Kotlin 2.0+ support):
60+
61+
Starting from version 14.0.0-rc, react-native-iap supports Google Play Billing Library v8.0.0, which requires Kotlin 2.0+. Since `expo-modules-core` doesn't support Kotlin 2.0 yet, you need to manually configure the Kotlin version.
62+
63+
Add the following to your `app.json`:
64+
65+
```json
66+
{
67+
"expo": {
68+
"plugins": [
69+
"react-native-iap",
70+
[
71+
"expo-build-properties",
72+
{
73+
"android": {
74+
"kotlinVersion": "2.1.20"
75+
}
76+
}
77+
]
78+
]
79+
}
80+
}
81+
```
82+
83+
2. **Install expo-dev-client**
84+
85+
Since in-app purchases require native modules that aren't available in Expo Go, you need to install expo-dev-client to create a custom development client. Learn more about [expo-dev-client](https://docs.expo.dev/versions/latest/sdk/dev-client/).
86+
87+
```bash
88+
npx expo install expo-dev-client
89+
```
90+
91+
3. **Install the plugin and run prebuild**:
92+
93+
```bash
94+
npx expo prebuild --clean
95+
```
96+
97+
This will generate the native iOS and Android directories with the necessary configurations. Learn more about [adopting prebuild](https://docs.expo.dev/guides/adopting-prebuild/).
98+
99+
4. Optional: Fix iOS Folly coroutine include error
100+
101+
If your iOS build fails with errors such as `'folly/coro/Coroutine.h' file not found` from `RCT-Folly/folly/Expected.h`, you can opt‑in to a workaround that disables Folly coroutine support during CocoaPods install.
102+
103+
Add this flag to the `react-native-iap` plugin options in your Expo config:
104+
105+
```json
106+
{
107+
"expo": {
108+
"plugins": [
109+
[
110+
"react-native-iap",
111+
{
112+
"ios": {
113+
"with-folly-no-coroutines": true
114+
}
115+
}
116+
]
117+
]
118+
}
119+
}
120+
```
121+
122+
Note migration:
123+
- This option key was renamed from `with-folly-no-couroutines` to `with-folly-no-coroutines`. Update your Expo config accordingly. For compatibility, the plugin temporarily accepts the old key and logs a deprecation warning.
124+
125+
What this does:
126+
- Injects `FOLLY_NO_CONFIG=1`, `FOLLY_CFG_NO_COROUTINES=1`, and `FOLLY_HAS_COROUTINES=0` into the Podfile `post_install` block for all Pods targets, preventing `RCT-Folly` from including non‑vendored `<folly/coro/*>` headers.
127+
- Idempotent: skips if you already set these defines yourself.
128+
129+
After enabling the flag, re-run prebuild:
130+
131+
```bash
132+
npx expo prebuild
133+
```
134+
135+
## Store Configuration
136+
137+
For detailed platform-specific configuration:
138+
139+
- [iOS Setup](./setup-ios.md) - iOS StoreKit configuration
140+
- [Android Setup](./setup-android.md) - Android Google Play Billing configuration
141+
142+
## Real world examples
143+
144+
For detailed platform-specific setup instructions, check out our real examples:
145+
146+
- [Purchase Flow](../examples/purchase-flow.md) - Complete purchase implementation
147+
- [Subscription Flow](../examples/subscription-flow.md) - Subscription management
148+
- [Available Purchases](../examples/available-purchases.md) - Restore purchases
149+
- [Offer Code](../examples/offer-code.md) - Promotional offers and codes

docs/docs/getting-started/setup-android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,6 @@ const handlePendingPurchase = (purchase: Purchase) => {
282282

283283
## Next Steps
284284

285-
- [Learn about getting started guide](../guides/getting-started)
285+
- [Review the installation guide](./installation)
286286
- [Explore iOS setup](./setup-ios)
287287
- [Understand error codes](../api/error-codes)

docs/docs/getting-started/setup-ios.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,5 @@ const handlePurchaseError = (error: any) => {
179179
## Next Steps
180180

181181
- [Learn about Android setup](./setup-android)
182-
- [Explore getting started guide](../guides/getting-started)
182+
- [Review the installation guide](./installation)
183183
- [Understand error codes](../api/error-codes)

0 commit comments

Comments
 (0)