We're happy to announce the release the version 8.4 of the React Native plugin.
This new release has quite a few enhancements and a new method getBillingStatus
that has been added in order to easily detect an error with the billing system.
When the billing system is unavailable, the products for sale will be filtered and an empty array will be returned.
You can use the getBillingStatus
method (after fetching the products) to detect when it is the case in order to display the appropriate error message.
On Android, we also recommend displaying an error message when the billing system is unavailable because the Google Play Store app is outdated (it can happen on old devices with an outdated software). Tell the user to open the Play Store app and go to Settings -> About and click on Update Play Store.
If the getBillingStatus
method doesn't return any error but your product is missing, it is most likely a misconfiguration issue.
You should check the filteredProductIds
property.
If your product ID is in the array, it is an issue with GooglePlay/iTunes (we are relying on them to fetch the products details). Otherwise it is an issue with IAPHUB. Please follow this guide to walk through the different possibilities that could cause this issue.
var status = await Iaphub.getBillingStatus();
if (status.error && status.error.code == "billing_unavailable") {
if (status.error.subcode == "play_store_outdated") {
// Display a message on your paywall saying that the Play Store app on the user's device is out of date, it must be updated
}
else {
// Display a message on your paywall saying that the in-app billing isn't available on the device
}
}
if (status.filteredProductIds.length) {
// Some products have been filtered because they were not returned by GooglePlay/iTunes
}
Enjoy!