Skip to main content

SDK Reference - getBillingStatus

React native
Flutter
Swift
Kotlin

The getBillingStatus method provides valuable insights into the current status of 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 this method (after fetching the products) to detect when this 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 due to an outdated Google Play Store app (which can occur on older devices with outdated software). Instruct the user to open the Play Store app, navigate to "Settings," select "About," and click on "Update Play Store."

If the method doesn't return any errors 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 indicates an issue with Google Play/Apple (as we rely on them to fetch the product details). Otherwise, it's likely an issue with IAPHUB. Please follow this guide to walk through the different possibilities that could cause this issue.

Example

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
}

Parameters

This method does not require any parameters.

Response

Object
ObjectError
Object
StringError message
StringError code
StringError sub code
String[]Filtered product ids