MIT License

项目介绍

hyochan/react-native-iap 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 MIT License 许可证,目前获得 3.2k 个 Star、685 次 Fork。

仓库全名
hyochan/react-native-iap
开源许可证
MIT License
Star 数
3.2k
Fork 数
685
未关闭 Issue
5

README 摘要

[!IMPORTANT] ⚠️ This repository has moved to hyodotdev/openiap. react-native-iap is now developed in the monorepo at libraries/react-native-iap — this repository is archived and read-only. 📦 This project now lives in the OpenIAP monorepo react-native-iap is actively maintained — development simply moved home. This repository is archived and kept read-only as history. 🧭 Source code | hyodotdev/openiap →…

完整内容见 GitHub 原始 README 或本页 。

常见问题

react-native-iap 用什么语言开发?

主要使用 TypeScript 编写,采用 MIT License 许可证,目前有 3.2k 个 Star。

react-native-iap 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 react-native-iap 的源码?

可以直接克隆仓库:git clone https://github.com/hyochan/react-native-iap.git,默认分支为 main;安装与运行步骤见仓库 README。

react-native-iap 最近还在维护吗?

仓库最近一次更新为 8月4日,当前有 5 个未关闭 Issue;Star 数为 3.2k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

In App Purchase module for React Native that confirms OpenIAP

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
4623
价值分
2141
活跃状态
归档

语言占比

C
C++
CMake
Java
JavaScript
Kotlin
Ruby
Shell
Swift
TypeScript

Release

README

Important 重要

⚠️ This repository has moved to hyodotdev/openiap. react-native-iap is now developed in the monorepo at libraries/react-native-iap — this repository is archived and read-only.

OpenIAP

📦 This project now lives in the OpenIAP monorepo

react-native-iap is actively maintained — development simply moved home.
This repository is archived and kept read-only as history.

🧭 Source code hyodotdev/openiap → libraries/react-native-iap
🏠 Monorepo hyodotdev/openiap
📚 Docs openiap.dev/docs/setup/react-native · legacy docs
🐛 Issues hyodotdev/openiap/issues
💬 Q&A react-native-iap discussions

The npm package name is unchanged — npm install react-native-iap keeps working as always.

Background: 📢 announcement issue · discussion thread


React Native IAP

React Native IAP Logo

Version Download OpenIAP CI - Test 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 the documentation →

⚠️ 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.

Compatibility (Nitro 14.x)

  • [email protected] (Nitro) requires React Native 0.79+.
  • Stuck on RN 0.75.x or lower? Use the last pre‑Nitro version: npm i [email protected].
  • 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

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

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.2.0"
          }
        }
      ]
    ]
  }
}

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:

🤖 Using with AI Assistants

React Native IAP provides AI-friendly documentation for Cursor, GitHub Copilot, Claude, and ChatGPT.

📖 AI Assistants Guide →

Quick links:

🎯 What’s Next?

📖 Visit our comprehensive documentation site →

Key Resources

Powered by OpenIAP

OpenIAP

React Native IAP conforms to the OpenIAP specification — 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 (StoreKit 2) and openiap-google (Play Billing 8.x)
  • Verification profiles — Standardized receipt validation and purchase verification patterns

Other libraries built on OpenIAP: expo-iap · flutter_inapp_purchase · kmp-iap · maui-iap · godot-iap

Learn more about the OpenIAP standard →

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

The original react-native-iap collective moved to opencollective.com/openiap and now supports the broader OpenIAP ecosystem.

Sponsors: OpenCollective sponsors

Backers: OpenCollective backers

Become a sponsor | Become a backer

Contributing

react-native-iap contributors

See our Contributing Guide for development setup and guidelines.

评论

暂无评论