Skip to content

candlefinance/react-native-purchase-kit

Repository files navigation



StoreKit 2 for React Native


It's built on top of the latest StoreKit 2 and Android Billing Library 3.0.0+ (coming soon). At the moment, it only supports subscriptions and there is a single API for both platforms. Check out below.

Installation

Requires iOS 15+ and Android minSdkVersion = 24.

yarn add react-native-purchase-kit

Basic Usage

Configure app to use StoreKit 2 and Android Billing Library 3.0.0+.

import PurchaseKit from 'react-native-purchase-kit';

const kit = new PurchaseKit();

// Get products
const products = await kit.getProducts(['monthly_subscription']);

// Buy a product
const transaction = await kit.purchase({
  productID: 'monthly_subscription',
  uuid: 'uuid',
});

// Get recent transactions
kit.getRecentTransactions();

// Get receipt
const receipt = await kit.readReceipt();

// Listen to events
kit.addListener('transactions', (event) => {
  if (event.kind === 'transactions') {
    console.log(event.transaction);
  }
});

License

MIT