Skip to content

hyochan/react-native-iap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

React Native IAP

React Native IAP Logo

Version Next Version Download Backers and Sponsors codecov FOSSA Status

React Native IAP is a high-performance in-app purchase library using Nitro Modules that conforms to the Open IAP specification. It provides a unified API for handling in-app purchases across iOS and Android platforms with comprehensive error handling and modern TypeScript support.

Open IAP

πŸ“š Documentation

πŸ“– Visit our comprehensive documentation site β†’

⚠️ Notice

Starting from version 14.0.0, this library uses Nitro Modules for high-performance native bridge implementation. You must install react-native-nitro-modules alongside react-native-iap.

✨ 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

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 β†’

πŸ—οΈ 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

Add the following dependencies to your android/app/build.gradle file:

dependencies {
    // Google Play Billing Library
    implementation "com.android.billingclient:billing-ktx:8.0.0"

    // Google Play Services
    implementation "com.google.android.gms:play-services-base:18.1.0"
}

Kotlin Version Requirement: This library requires Kotlin 2.0+. Configure your project's Kotlin version:

In your root android/build.gradle:

buildscript {
    ext {
        kotlinVersion = "2.1.20"
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

iOS Configuration

  1. Install pods:

    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:

{
  "expo": {
    "plugins": [
      "react-native-iap",
      [
        "expo-build-properties",
        {
          "android": {
            "kotlinVersion": "2.1.20"
          }
        }
      ]
    ]
  }
}

Note: Expo projects require development build (dev-client) as this library contains native code.

Store Configuration

React Native IAP is OpenIAP compliant. For detailed store configuration:

🎯 What's Next?

πŸ“– Visit our comprehensive documentation site β†’

Key Resources

Sponsors

πŸ’Ό View Our Sponsors

Angel

courier_dot_com

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.


OpenCollective Sponsorship

We also manage sponsorships through OpenCollective, which operates separately from our main sponsor program.

Sponsors:

Backers:

Become a sponsor | Become a backer

Contributing

See our Contributing Guide for development setup and guidelines.