Skip to main content

2 posts tagged with "react-native-iaphub"

View All Tags

· 2 min read

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


· 2 min read

We're happy to announce the release the version 8.3 of the React Native plugin.
This new release is shipping some really helpful features!

What's new?

A new onDeferredPurchase event

Thanks to this event you'll now be able to easily detect when a new purchase occurs outside of the buy method.
For instance this event can be trigerred:

  • After a purchase is made outside the app (by redeeming a promo code on the store by example)
  • After a deferred payment (when the error code 'deferred_payment' is returned by the buy method)
  • After a payment fails because it couldn't be validated by IAPHUB (and succeeds later)
  var listener = Iaphub.addEventListener('onDeferredPurchase', async (transaction) => {


The enhancement of the restore method

The restore method will now return a RestoreResponse object.
This object will contain two properties:

  • newPurchases: The new purchases processed during the restore
  • transferredActiveProducts: The active products transferred (from another user) during the restore
var response = await Iaphub.restore();
// New purchases
console.log('New purchases: ', response.newPurchases);
// Extisting active products transferred to the user
console.log('Transferred active products: ', response.transferredActiveProducts);

New properties for the ActiveProduct object

We've also added a few extra properties for the active products.

  • isPromo
  • promoCode
  • originalPurchase