Skip to main content
Solved

GetProducts type magic string and empty products array


Forum|alt.badge.img+7

In Unity SDK there is GetProducts method with this semantics:

public void GetProducts(string[] products, GetProductsFunc callback, string type = "subs")

 

How we should know this magic strings for “type”?

 

I want to display Price in game user interface. This price can be obtained through StoreProduct. But I can’t get ANY StoreProduct, because GetProducts alwats return empty array. I wanted to change type from “subs” to anything else, but there is no another constants mentioned in docs \ code.

 

Please help me to fetch all my products and check prices for them. 

Platform: Unity3d, Android & iOS

Best answer by sharif

Hello,

Thanks for the honest feedback, we’ll improve our docs here.

We do have a sample app that might help see the usage of our SDK, for example here’s a “GetAllProducts” method that gets all products by using GetOfferings and GetProducts: https://github.com/RevenueCat/purchases-unity/blob/0be86203d1d7c98d80486f0124fa38e331aa3373/Subtester/Assets/Scripts/PurchasesListener.cs#L517-L549

The two values that type can be are “subs” and “inapp” as seen here: https://github.com/RevenueCat/purchases-hybrid-common/blob/0c645cf492a118035282bdb4214b61c82fb5d124/android/src/main/java/com/revenuecat/purchases/hybridcommon/common.kt#L522-L523

I don’t expect you to dig through the code to find those, I’m simply sharing them here to help out. I’ll add a ticket in our system to document them.

View original
Did this post help you find an answer to your question?

2 replies

Forum|alt.badge.img+7
  • Author
  • Helper
  • 7 replies
  • August 2, 2023

Still can’t understand how this function works. For now we swith to GetOfferings because at least we understand how it works. For this we still need additional explanations \ docs. 


sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • Answer
  • August 3, 2023

Hello,

Thanks for the honest feedback, we’ll improve our docs here.

We do have a sample app that might help see the usage of our SDK, for example here’s a “GetAllProducts” method that gets all products by using GetOfferings and GetProducts: https://github.com/RevenueCat/purchases-unity/blob/0be86203d1d7c98d80486f0124fa38e331aa3373/Subtester/Assets/Scripts/PurchasesListener.cs#L517-L549

The two values that type can be are “subs” and “inapp” as seen here: https://github.com/RevenueCat/purchases-hybrid-common/blob/0c645cf492a118035282bdb4214b61c82fb5d124/android/src/main/java/com/revenuecat/purchases/hybridcommon/common.kt#L522-L523

I don’t expect you to dig through the code to find those, I’m simply sharing them here to help out. I’ll add a ticket in our system to document them.


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