react-native-purchase-kit
v0.4.0
Published
StoreKit 2 and Billing API for React Native
Downloads
18
Readme
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