In this video I'll show how to get up and running with in app purchases (subscriptions) in React Native for android.
Good news is that you can use the simulator as long as the Google Play store is installed the emulator and you're logged into your google account.
Important note: In android you can have multiple subscriptions running at the same time, it doesn't just change the subscription like in iOS which is really neat so make sure you've the logic in place to handle that!
Libraries used:
googleapis
react-native-iap
The steps showed in the video:
Pre steps:
Sign up for the Google Developer program
Submit a release, upload apb and get it approved
Create service account in Google Developer Console
Add owner rights to the service account and link it in the Google Play Console
Add subscriptions in the Google Play console and activate them
In the app:
getSubscriptions()
requestSubscription(productId)
purchaseUpdatedListener
Save Receipt in backend
finishTransaction()
Backend:
Backend code, receipt validation, (productId, receiptToken), check for paymentState === 1