Skip to main content

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?

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/). 

 


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!


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