Skip to main content
Question

Purchases.getProducts returns empty array


Forum|alt.badge.img

I believe I have configured everything correctly, but I am unable to purchase on Android.

I have followed everything shown in this link 'https://community.revenuecat.com/sdks%2D51/why%2Dare%2Dofferings%2Dor%2Dproducts%2Dempty%2D124' but it still doesn't work.

Configure

  if (Platform.OS === 'ios') {

   try {

   Purchases.configure({

   apiKey: REVENUE_CAT_IOS_API_KEY,

   appUserID: user?.uid,

   })

   } catch (error) {

   console.error('error configuring revenuecat for iOS', error)

   await analytics().logEvent('error_configuring_revenuecat_for_ios')

   }

   } else if (Platform.OS === 'android') {

   try {

    Purchases.configure({

    apiKey: REVENUE_CAT_ANDROID_API_KEY,

    appUserID: user?.uid,

  })

 } catch (error) {

  console.error('error configuring revenuecat for Android', error)

  await analytics().logEvent('error_configuring_revenuecat_for_android')

 }

}

 

This is where I am trying to fetch the products.

  const purchaseStoryToken = async () => {
    try {
      useSetLoading(true)

      const products = await Purchases.getProducts(['dk_story_token'])
      console.log('fetched products', products)
      const storyTokenProduct = products?.[0]
      console.log('storyTokenProduct', storyTokenProduct)

      await Purchases.purchaseStoreProduct(storyTokenProduct)
    } catch (e) {
      analytics().logEvent('error_purchasing_product')
      console.log('error in purchaseStoryToken', e)
      throw e
    } finally {
      useSetLoading(false)
    }
  }
 LOG  fetched products []
 LOG  storyTokenProduct undefined
 LOG  error in purchaseStoryToken [TypeError: Cannot read property 'identifier' of undefined]

 

Products
Offerings


 

Entitlements

 

I created APK and tested it on a real device as well as on the simulator. The result is the same.

I might have overlooked something, please allow me to know if more information is needed.

Questions:
1- Where should the 'dk_story_token' inside the 'Purchases.getProducts(['dk_story_token'])' code exactly come from? Where can I retrieve this information, within the Google Play Console or in Revenue Car's dashboard? Where did this string come from? 

I'm assuming this string is correct because it works for apple and I've been told that it's the same on the google play side. i'm asking to confirm. Where can I get this?

2- I don't think I have missed a step; I have double-checked multiple times. What should I do?

7 replies

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 509 replies
  • January 24, 2024

Hi, the value inside Purchases.getProducts() ‘dk_story_token’ is the product that you want to purchase. This string is the product id of the product you have created in Google Play Console that is also the product id in RevenueCat. 

Looking at your setup, the problem might be that your product test3 is not in RevenueCat. Could you try adding this and see if it works?

If not, then can you please enable RevenueCat SDK’s debug logs and send the entirety here so I may see what is happening there. You can enable them following our guide here: https://www.revenuecat.com/docs/debugging#section-debugging


Forum|alt.badge.img
  • New Member
  • 3 replies
  • February 13, 2025

@coyotiv-gmbh-bdcbc5 

We have had this same issue for weeks now with their RN SDK, did you ever find a solution? I wonder why its so hard to just get a product.


akinjide wrote:

@coyotiv-gmbh-bdcbc5 

We have had this same issue for weeks now with their RN SDK, did you ever find a solution? I wonder why its so hard to just get a product.

It's been a while, so I don't remember exactly, but our issue was having two projects. First of all, make sure you're in the correct project. Also, ensure that your products are properly set up in the Google Play Console. When we solved it, we ignored all previous issues and worked through the document step by step with a clear head. I can imagine what a difficult process it has been for you—good luck!


Forum|alt.badge.img
  • New Member
  • 3 replies
  • February 13, 2025
göktürk-acar-e2031b wrote:
akinjide wrote:

@coyotiv-gmbh-bdcbc5 

We have had this same issue for weeks now with their RN SDK, did you ever find a solution? I wonder why its so hard to just get a product.

It's been a while, so I don't remember exactly, but our issue was having two projects. First of all, make sure you're in the correct project. Also, ensure that your products are properly set up in the Google Play Console. When we solved it, we ignored all previous issues and worked through the document step by step with a clear head. I can imagine what a difficult process it has been for you—good luck!

Thanks!
we also have two projects, pretty sure i’m targeting the right one.
Whats even funnier is, old products get fetch, but we just can’t get any product we have created within the last 30 days or so now.


Forum|alt.badge.img+8
  • RevenueCat Staff
  • 509 replies
  • February 20, 2025

Hi ​@akinjide, are you still having trouble with this? If so can you open a support ticket here and share the following:

  • The SDK version you are on
  • Your purchase code
  • Full debug logs of when you attempt to fetch a product created within the last 30 days
  • Screenshots of how the products created within the last 30 days are configured in the Google Play Console
  • And are you importing products or manually entering them?

  • New Member
  • 2 replies
  • March 12, 2025

Any update on this ?
I am having the same issue with their flutter library.


  • New Member
  • 2 replies
  • March 13, 2025
lanrehnics wrote:

Any update on this ?
I am having the same issue with their flutter library.

Just incase anybody is having this issue , you need to pass the second parameter of product category . 
I am using flutter so it’s something like 
 

await Purchases.getProducts(['your_product_id'], productCategory: ProductCategory.nonSubscription); 

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