Solved

Getting products without offerings, sdk needs an upgrade

  • 2 October 2023
  • 5 replies
  • 178 views

Badge

Hi guys,

I'm configuring all products for my app. I have all of them imported from google play and my entitlements configured.
In the docs you say that offerings are optional, but that's not true, because the sdk can't get product data without offerings and packages. I'm using unity sdk.

What's the point of this?
 

If I already have the products, I should be able to get all the data of each specific product, even if I don't have any offering.
But right now, for me to get the products data and display them on muy app, I have to create an offering and a package for each product. And to be honest that's horrible, because I'm just duplicating products into packages for no reason at all, and also because the UI to attach products to packages it's very very bad, specially if you have lot's of products.

So, is there in the roadmap and update to fix this?
If not, at least update your documentation that you HAVE to have products, offerings and packages for revenuecat to work at it should.

Thanks!

icon

Best answer by toni-rico 2 October 2023, 13:49

View original

5 replies

Userlevel 2
Badge +3

Hi @Ivan LC, have you tried the GetProducts and PurchaseProduct functions in Purchases?

The first one allows you to get the information for a product by using the product id. The second one, allows you to purchase a product using the product id.

For example, the PurchaseProduct function can be used like this:

purchases.PurchaseProduct(
"your_product_id",
(productIdentifier, customerInfo, userCancelled, error) =>
{
handlePurchaseCompletion(customerInfo, userCancelled, error);
},
"subs" // Use inapp if you're not purchasing a subscription
);

Let me know if that doesn’t solve your issue or if you have other questions.

Badge

Hi @toni-rico

Yes I did. PurchaseProduct works fine, but GetProducts always returns an empty array, doesn't matter if I pass "subs" or "inapp".
Here is a discussion about GetProducts and I can't get it to work either :(.

Userlevel 2
Badge +3

Hi @Ivan LC, can you add a small code sample of how you’re calling `GetProducts`? Also sending logs would be helpful in order to diagnose this issue.

Let me know if you need any help with that in the meantime!

Badge

Hi @toni-rico, I was just doing some test to send you the logs and the code, and I figured it out!

What was happening is, in my 'Purchases' product identifiers I had both in-app purchases and subscriptions, and that's why my 'GetProducts' was always returning 0.

I tested only with in-app purchases ids and calling 'GetProducts' with the 'inapp' parameter and it works.
Also only with subscription ids calling 'GetProducts' with the 'subs' parameter and it works too.

So if you mix both, it doesn't return anything instead of returning only the ids that works. And if one of those ids is wrong, it will return 0 products too.

Anyway it works. Thanks!

Userlevel 2
Badge +3

Ahh makes sense thanks for reporting the result! And glad that you got it working 🙌

Reply