Skip to main content
Question

How to check active entitlements using API


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

Is there any way using the v1 (or v2) API to check more directly whether an entitlement is active? 

 

The SDK has something like

 

if !customerInfo!.entitlements.active.isEmpty 
 

but it seems like the API just returns something like:

 

      "entitlements" : {          "premium" : {             "expires_date" : "2024-04-23T14:43:37Z",             "grace_period_expires_date" : null,             "product_identifier" : "monthly",             "purchase_date" : "2024-04-23T14:38:37Z"          }

 

when hitting the GET /subscriber endpoint. 

This means I have to check the expires_date against Date.now() or something like that which feels clunky rather than having the attribute calculated directly on the API.

 

 

This post has been closed for comments

2 replies

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 430 replies
  • April 26, 2024

Hi, at this time our recommended way is to use our GET subscriber endpoint and to check the entitlement object. We do have in our APIv2 beta an endpoint to get a list of customer's active entitlements which sounds like it would work for your use case. You can enroll in our APIv2 beta here to use this endpoint: https://www.revenuecat.com/docs/api-v2#tag/Overview-(v2)/Beta-Interest


Forum|alt.badge.img+2
  • Author
  • New Member
  • 2 replies
  • April 29, 2024

What about the subscriptions billing period? I need to know for an entitelment when the billing period started and ended.

I’ve noticed that the purchase_date and expires_at when you hit the v1 subscriptions endpoint doesn’t seem to update correctly when I, for instance, grant a promotional three day access to the entitlement via the revenue cat dashboard. I see the subscription, but the entitlement doesnt have the updated date values. This seems like a bug, or just possibly very confusing access patterns. 


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