Skip to main content
Solved

activeSubscriptions vs entitlements.active


Forum|alt.badge.img+4
  • New Member
  • 4 replies

Hello,

 

I have multiple subscription offers, but only need to see if a user is subscribed to at least one to give them access to premium features. Since I’ve started using RevenueCat years ago, I check `purchaserInfo.activeSubscriptions.isEmpty` but RevenueCat’s documentation says to use `purchaserInfo.entitlements.active.isEmpty`. 

 

What’s the difference between the two methods?

Best answer by Andy

Hi @fra

 

The distinction is that the “entitlement” represents what this person should have access to, whereas the subscription is more about the “how”, and is specific to subscriptions. 

 

Suppose that in your app you have a “pro” feature, that should be accessible to people who pay for it. 

This would be represented as a “pro” entitlement. 

You could have a $2.99/month subscription that unlocks the “pro” entitlement, but you could also have a $10.99/year that unlocks “pro”. In either of these cases, checking if there’s at least one subscription in “active subscriptions” would do the trick, same as checking for the “pro” entitlement. 

 

However, if you also had a non-subscription product, for example a lifetime non-consumable, at $149.99, that unlocks “pro”, then that wouldn’t show up in subscriptions, so checking for activeSubscriptions wouldn’t work. Checking if the user has access to the “pro” entitlement would still work. 

 

This also extends to for example if you wanted to expand on the subscriptions, and wanted to have tiers, where there’s a “pro” and a “super” layer, where some subscription products unlock one, others unlock both, etc.

 

So in the end it’s all about flexibility, and allowing you to make changes to how you monetize your app without having to change your code. We recommend using entitlements, because they more closely represent the fact that you want to decide whether a user has access to something in your app, and de-couple that with the “how” they got that access. 

 

Entitlements can even help you set up beta features and be used in several other ways (see an example in this blog post https://www.revenuecat.com/blog/using-entitlements-for-feature-flags/). 

 

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

3 replies

Andy
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 237 replies
  • Answer
  • August 8, 2022

Hi @fra

 

The distinction is that the “entitlement” represents what this person should have access to, whereas the subscription is more about the “how”, and is specific to subscriptions. 

 

Suppose that in your app you have a “pro” feature, that should be accessible to people who pay for it. 

This would be represented as a “pro” entitlement. 

You could have a $2.99/month subscription that unlocks the “pro” entitlement, but you could also have a $10.99/year that unlocks “pro”. In either of these cases, checking if there’s at least one subscription in “active subscriptions” would do the trick, same as checking for the “pro” entitlement. 

 

However, if you also had a non-subscription product, for example a lifetime non-consumable, at $149.99, that unlocks “pro”, then that wouldn’t show up in subscriptions, so checking for activeSubscriptions wouldn’t work. Checking if the user has access to the “pro” entitlement would still work. 

 

This also extends to for example if you wanted to expand on the subscriptions, and wanted to have tiers, where there’s a “pro” and a “super” layer, where some subscription products unlock one, others unlock both, etc.

 

So in the end it’s all about flexibility, and allowing you to make changes to how you monetize your app without having to change your code. We recommend using entitlements, because they more closely represent the fact that you want to decide whether a user has access to something in your app, and de-couple that with the “how” they got that access. 

 

Entitlements can even help you set up beta features and be used in several other ways (see an example in this blog post https://www.revenuecat.com/blog/using-entitlements-for-feature-flags/). 

 


Forum|alt.badge.img+4
  • Author
  • New Member
  • 4 replies
  • August 8, 2022

Hi @Andy,

 

Thank you for the quick response and detailed message. One question I have from your response:

 

If the subscription has “pro” and “super” tiers, would checking `!purchaserInfo.entitlements.active.isEmpty` work for unlocking features that are for both the “pro” and “super” tiers?

 

If so, is the only way to unlock “super” tier features be to check if the super tier entitlement ID is in the user’s list of active entitlements?

 

Thanks again!


Andy
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 237 replies
  • August 8, 2022

Happy to help! 

For features that would be unlocked by any entitlement, `!purchaserInfo.entitlements.active.isEmpty` would work. 

 

For stuff that would be specific to one entitlement, it’d be `purchaserInfo.entitlements.active[“super”] != nil`


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