Skip to main content
Question

How do I handle errors when fetching products?


Forum|alt.badge.img

In my Android Jetpack Compose app I am using 
com.revenuecat.purchases:purchases 8.14.0 and com.revenuecat.purchases:purchases-ui 8.14.0.

 

The paywall is displayed like this:
 

import com.revenuecat.purchases.CustomerInfo
import com.revenuecat.purchases.models.StoreTransaction
import com.revenuecat.purchases.ui.revenuecatui.Paywall
import com.revenuecat.purchases.ui.revenuecatui.PaywallListener
import com.revenuecat.purchases.ui.revenuecatui.PaywallOptions

...

Paywall(
    PaywallOptions.Builder({})
        .setListener(object : PaywallListener {
            override fun onPurchaseCompleted(
                customerInfo: CustomerInfo,
                storeTransaction: StoreTransaction
            ) {
                if (customerInfo.entitlements.active.containsKey(ENTITLEMENT_ID)) {
                    setShouldPaywall(false)
                }
            }

            override fun onRestoreCompleted(customerInfo: CustomerInfo) {
                if (customerInfo.entitlements.active.containsKey(ENTITLEMENT_ID)) {
                    setShouldPaywall(false)
                }
            }
        })
        .build(),
)

How can I catch and handle any errors that occurs when, for example, fetching the offerings?

I am currently in the situation where I have developed and configured my app to only be available in Sweden. But when submitting the app for review it gets rejected because it is  (probably) reviewed in the US.

This results in a configuration error that I can also reproduce if I create and login with a US Google Account on my Android device or emulator.

Similar errors occurs if the user does not have an internet connection. How can I catch and customize the displayed error?

 

 


 

 

This seems similar to 

 but I do not know how to properly catch the error and display my own.

3 replies

Forum|alt.badge.img+3

Hi ​@oskarp I suspect this may be an issue of your subscription geographical availability which is configured on Google Play Console. We have documentation on creating Google products here: https://www.revenuecat.com/docs/getting-started/entitlements/android-products#create-an-in-app-product-or-subscription which you have already done so. I see the response from Google that you have only configured the product to be available to Sweden. I recommend updating the availability to include additional countries like the US. 

 

 


Forum|alt.badge.img
  • Author
  • New Member
  • 2 replies
  • March 7, 2025

Why would I have to include additional countries when the app is only targeted and relevant for Swedish customers?

Also, I’m still not sure how to catch and handle these errors. For example if the user’s network is down when fetching the products.


jeffrey_bunn
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 240 replies
  • March 13, 2025

Hi ​@oskarp - related to the specific error message you see, can you review this interactive guide to ensure everything is correctly configured? I want to rule out issues other than the possible availability issue, as there are a number of reasons this message could appear. Thanks!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings