Solved

How do I determine if a product has a specific entitlement?

  • 24 January 2023
  • 2 replies
  • 36 views

Badge

Background:  I am sharing an entitlement across the App Store, Play Store and Stripe. Currently there is a single entitlement but I want to be able to add additional products and entitlements in the future.

For my current issue:

Entitlement identifier: “standard” is associated with 3 products (one on each platform)

Offering identifier: “default” has one package “Monthly” which points to the same 3 products

Products (3 of them) have unique identifiers (for example): ios_id, play_id and stripe_id

Situation: A user buys a subscription in Stripe and I want to know if they have the same entitlement when I look at customerInfo in the App store or the Play store.

Platform: React Native

SDK: "react-native-purchases": "^5.4.0"

Issue:

When I call Purchases.getOfferings(). I receive only the offerings for the platform I am on.  Example on the App store the availablePackages array only contains the product I have associated with the App store: ios_id (which I would expect).  With the package identifier as “$rc_monthly” and the offeringIdentifier as “default”

When I look at customerInfo for the user that purchased this entitlement on Stripe it returns the active entitlement but of course uses the Stripe product identifier: stripe_id. It gives me the entitlement identifier “standard”

Question: How do I determine that stripe_id and ios_id share the same entitlement?

I think a bad answer would be: Keep your product IDs in sync across the 3 platforms.  This is very fragile and seems to work against the whole concept of entitlements. Entitlements are configured to capture this relationship

If there is some call I overlooked that has this relationship then that would be awesome.

In the absence of “all related products” coming in the entitlement object I was looking for a way to get ALL the product ids associated with a package or an entitlement but could not find it.

Thanks for reading and hopefully pointing me in the right direction.

icon

Best answer by kaitlin 26 January 2023, 18:17

View original

2 replies

Userlevel 1
Badge +3

Hi @rsmith,

You’re correct that getOfferings will only pull the products for the specific platform that you’re calling from, or specifying in the header. 

At this time, the best way to check which products are attached to a given entitlement is via the dashboard, but having an endpoint where you can check this information is something that we have on our roadmap for the next version of our API, which is currently in beta. 

 

Badge

Thank you @kaitlin .  I look forward to this feature.

Reply