I’ve implemented react-native-iap module 6 months ago and lots of people are asking specific steps to integrate the module to their own react-native project. Therefore I’ve decided to write a guide to setup in app purchase in both ios and android platforms so that I can help your life easier. Also recently, I’ve implemented flutter_inapp_purchase module. React Native In App Purchase and Flutter In App Purchase is ready.
Setup your in app products for ios in itunesconnect.
- You need to complete the Agreements, Tax and Bankings.
- Add In-App Purchases in Features tab. Check that your product’s status is Ready to Submit.
3. Check your xcode setting and make In-App Purchase available.
Now, you’re done with ios side configuration. So lets go for android.
Setup your in-app purchases for android in playstore.
- As described in above screenshot, you need to upload apk with billing permission and set up merchant account before creating in-app product.
<uses-permission android:name="com.android.vending.BILLING" />
- If you’ve done it, you can create a managed product as shown in below screenshot.
That’s it. You can now go to your react-native project and include our module as described in the readme.
Summary for integrating react-native-iap.
- npm install — save react-native-iap
- react-native link react-native-iap
- Prepare In App billing, then buyProduct.
import * as RNIap from 'react-native-iap';...
try {
await RNIap.prepare();
const products = await RNIap.getProducts(itemSkus);
this.setState({ items });
} catch(err) {
console.warn(err);
}
Please write up issue, if you have any problem.