Skip to main content
Answer

[EXPO] Why does Purchases.getOfferings() return item but Purchases.getProducts() returns empty array

  • May 14, 2022
  • 1 reply
  • 298 views

Forum|alt.badge.img+2

Im wondering why is it that i retrieve data back from “getOfferings” but not "getProducts”. I’d imagine that the fact that im receiving data for “getOfferings” means my current setup is correct. Any insight on this? Is there something more needed for “getProducts” to work?

Info​​​​​​

  • Expo SDK 44
  • react-native-purchases 4.5.3
  • Observed on iOS
// Example response: await Purchases.getOfferings().all['Default']
{"availablePackages": [{"identifier": "$rc_lifetime", "offeringIdentifier": "Default", "packageType": "LIFETIME", "product": [Object]}], "identifier": "Default", "lifetime": {"identifier": "$rc_lifetime", "offeringIdentifier": "Default", "packageType": "LIFETIME", "product": {"currency_code": "USD", "description": "Anime themed game deck!", "discounts": [Array], "identifier": "AnimeYouShouldKnow", "introPrice": null, "intro_price": null, "intro_price_cycles": null, "intro_price_period": null, "intro_price_period_number_of_units": null, "intro_price_period_unit": null, "intro_price_string": null, "price": 0.9900000095367432, "price_string": "$0.99", "title": "Anime You Should Know"}}, "serverDescription": "All decks available for purchase"}

// Example response: await Purchases.getProducts()
[]

 

Best answer by Brandon J Irving

UPDATE: 

Yea this was my own fault, i didnt read the arguments list. You need an array of bundleIds for the function to return items back:

Purchases.getProducts([‘bundleId1’])

 

That was the issue. So word of advice to folks, look at the sdk docs

This post has been closed for comments

1 reply

Forum|alt.badge.img+2

UPDATE: 

Yea this was my own fault, i didnt read the arguments list. You need an array of bundleIds for the function to return items back:

Purchases.getProducts([‘bundleId1’])

 

That was the issue. So word of advice to folks, look at the sdk docs