https://github.com/hyochan/react-native-iap
In App Purchase module for React Native that confirms OpenIAP
https://github.com/hyochan/react-native-iap
amazon android appstore billing iap in-app-purchase ios openiap playstore react-native react-native-iap
Last synced: 2 months ago
JSON representation
In App Purchase module for React Native that confirms OpenIAP
- Host: GitHub
- URL: https://github.com/hyochan/react-native-iap
- Owner: hyochan
- License: mit
- Created: 2017-10-22T00:31:20.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2026-03-25T22:31:39.000Z (3 months ago)
- Last Synced: 2026-03-26T10:48:10.434Z (3 months ago)
- Topics: amazon, android, appstore, billing, iap, in-app-purchase, ios, openiap, playstore, react-native, react-native-iap
- Language: TypeScript
- Homepage: https://hyochan.github.io/react-native-iap
- Size: 206 MB
- Stars: 3,217
- Watchers: 34
- Forks: 695
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# React Native IAP
[](https://npmjs.org/package/react-native-iap)
[](https://npmjs.org/package/react-native-iap)
[](https://openiap.dev)
[](https://opencollective.com/react-native-iap)
[](https://github.com/hyochan/react-native-iap/actions/workflows/ci-test.yml)
[](https://codecov.io/gh/hyochan/react-native-iap)
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Freact-native-iap?ref=badge_shield&issueType=license)
**React Native IAP** is a high-performance in-app purchase library using Nitro Modules that **conforms to the [Open IAP specification](https://openiap.dev)**. It provides a unified API for handling in-app purchases across iOS and Android platforms with comprehensive error handling and modern TypeScript support.
## π¨ Promotion
**Compile-time CSS-in-JS for React Native**
β¨ Banishing runtime overhead, one style at a time with **[kstyled](https://hyodotdev.github.io/kstyled)** - fully type-safe styling that compiles away.
π **[Explore kstyled β](https://hyodotdev.github.io/kstyled)**
## π Documentation
**[π Visit our comprehensive documentation site β](https://hyochan.github.io/react-native-iap)**
## β οΈ Notice
**Starting from version 14.0.0**, this library uses [Nitro Modules](https://github.com/mrousavy/nitro) for high-performance native bridge implementation. You must install `react-native-nitro-modules` alongside `react-native-iap`.
### Compatibility (Nitro 14.x)
- `react-native-iap@14.x` (Nitro) requires **React Native 0.79+**.
- Stuck on **RN 0.75.x or lower**? Use the last preβNitro version: `npm i react-native-iap@13.1.0`.
- Seeing Swift 6 C++ interop errors in Nitro (e.g., `AnyMap.swift` with `cppPart.pointee.*`)? Temporarily pin Swift to **5.10** for the `NitroModules` pod (see Installation docs) or upgrade RN and Nitro deps.
- Recommended: upgrade to RN 0.79+, update `react-native-nitro-modules`/`nitro-codegen`, then `pod install` and clean build.
More details and the Podfile snippet are in the docs: https://hyochan.github.io/react-native-iap/docs/installation#ios
## β¨ Features
- π **Cross-platform Support**: Works seamlessly on both iOS and Android
- β‘ **Nitro Modules**: High-performance native bridge with minimal overhead
- π― **TypeScript First**: Full TypeScript support with comprehensive type definitions
- π‘οΈ **Centralized Error Handling**: Unified error management with platform-specific error code mapping
- π£ **React Hooks**: Modern React hooks API with `useIAP`
- π± **Expo Compatible**: Works with Expo development builds
- π **Receipt Validation**: Built-in receipt validation for both platforms
- π **Products & Subscriptions**: Support for both one-time purchases and subscriptions
- π **Performance Optimized**: Efficient caching and minimal re-renders
## π Quick Start
```bash
npm install react-native-iap react-native-nitro-modules
# or
yarn add react-native-iap react-native-nitro-modules
```
**[π See the complete installation guide and quick start tutorial β](https://hyochan.github.io/react-native-iap/docs/installation)**
## ποΈ Architecture
React Native IAP is built with a modern architecture that emphasizes:
- **Nitro Modules**: High-performance native bridge with C++ core and platform-specific implementations
- **Type Safety**: Comprehensive TypeScript definitions for all APIs
- **Error Resilience**: Centralized error handling with meaningful error codes
- **Platform Abstraction**: Unified API that handles platform differences internally
- **Performance**: Optimized for minimal bundle size and runtime performance
## π± Platform Support
| Platform | Support | Notes |
| ----------------- | ------- | --------------------------------------- |
| iOS | β
| StoreKit 2 (requires iOS 15+) |
| Android | β
| Google Play Billing v8.0.0+ |
| Expo Go | β | Not supported (requires native modules) |
| Expo Dev Client | β
| Full support |
| Bare React Native | β
| Full support |
## π¦ Installation & Configuration
### Prerequisites
Before installing React Native IAP, make sure you have:
- React Native 0.64 or later, or Expo SDK 45 or later
- Node.js 16 or later
- iOS 15+ for iOS apps (StoreKit 2 requirement)
- Android API level 21+ for Android apps
### Post Installation
#### Android Configuration
**Kotlin Version Requirement:** This library requires Kotlin 2.0+. Configure your project's Kotlin version:
In your root `android/build.gradle`:
```gradle
buildscript {
ext {
kotlinVersion = "2.1.20"
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
```
#### iOS Configuration
1. **Install pods**:
```bash
cd ios && pod install
```
2. **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"
#### Expo Configuration
For Expo projects, add the plugin to your `app.json` or `expo.json`:
```json
{
"expo": {
"plugins": [
"react-native-iap",
[
"expo-build-properties",
{
"android": {
"kotlinVersion": "2.2.0"
}
}
]
]
}
}
```
**Note:** Expo projects require [development build (dev-client)](https://docs.expo.dev/develop/development-builds/introduction/) as this library contains native code.
### Store Configuration
React Native IAP is **OpenIAP compliant**. For detailed store configuration:
- **[iOS Setup β](https://www.openiap.dev/docs/ios-setup)** - App Store Connect configuration
- **[Android Setup β](https://www.openiap.dev/docs/android-setup)** - Google Play Console configuration
## π€ Using with AI Assistants
React Native IAP provides AI-friendly documentation for Cursor, GitHub Copilot, Claude, and ChatGPT.
**[π AI Assistants Guide β](https://hyochan.github.io/react-native-iap/docs/guides/ai-assistants)**
Quick links:
- [llms.txt](https://hyochan.github.io/react-native-iap/llms.txt) - Quick reference
- [llms-full.txt](https://hyochan.github.io/react-native-iap/llms-full.txt) - Full API reference
## π― What's Next?
**[π Visit our comprehensive documentation site β](https://hyochan.github.io/react-native-iap)**
### Key Resources
- **[Installation & Quick Start](https://hyochan.github.io/react-native-iap/docs/installation)** - Get started in minutes
- **[API Reference](https://hyochan.github.io/react-native-iap/docs/api)** - Complete useIAP hook documentation
- **[Examples](https://hyochan.github.io/react-native-iap/docs/examples/basic-store)** - Production-ready implementations
- **[Error Handling](https://hyochan.github.io/react-native-iap/docs/api/error-codes)** - OpenIAP compliant error codes
- **[Troubleshooting](https://hyochan.github.io/react-native-iap/docs/guides/troubleshooting)** - Common issues and solutions
## Powered by OpenIAP
React Native IAP conforms to the **[OpenIAP specification](https://openiap.dev)** β an open, vendor-neutral interoperability standard for in-app purchases. OpenIAP provides:
- **Shared specification** β Common types, error codes, and purchase flows across all platforms
- **Generated type-safe bindings** β Swift, Kotlin, Dart, and GDScript from a single GraphQL schema
- **Platform implementations** β [openiap-apple](https://github.com/hyodotdev/openiap/tree/main/packages/apple) (StoreKit 2) and [openiap-google](https://github.com/hyodotdev/openiap/tree/main/packages/google) (Play Billing 8.x)
- **Verification profiles** β Standardized receipt validation and purchase verification patterns
Other libraries built on OpenIAP: [expo-iap](https://github.com/hyochan/expo-iap) Β· [flutter_inapp_purchase](https://github.com/hyochan/flutter_inapp_purchase) Β· [kmp-iap](https://github.com/hyochan/kmp-iap) Β· [godot-iap](https://github.com/hyochan/godot-iap)
**[Learn more about the OpenIAP standard β](https://openiap.dev/docs/foundation/about)**
## Sponsors
πΌ **[View Our Sponsors](https://openiap.dev/sponsors)**
###
Angel
## Past Supporters
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Buy me a coffee](https://www.buymeacoffee.com/hyochan).
---
### OpenCollective Sponsorship
We also manage sponsorships through OpenCollective, which operates separately from our main sponsor program.
[Become a sponsor](https://opencollective.com/react-native-iap#sponsor) | [Become a backer](https://opencollective.com/react-native-iap#backer)
## Contributing
See our [Contributing Guide](./CONTRIBUTING.md) for development setup and guidelines.