Question

How to download entitlements for backend?

  • 8 March 2023
  • 1 reply
  • 70 views

Userlevel 1
Badge +4

We’ve been using RevenueCat entitlements client-side with some success. That’s great.

We’re now trying to integrate this with our backend to control the nature of the push notifications we do and do not send (and/or what the content of that push notification is).

Yes, we have the webhook set up, and that works fine. But how do we sync our backend with the RevenueCat entitlements to, effectively, catch up on which users are already entitled? (I don’t really want to know the individual subscription/product for which people have signed up, just who is entitled to what.)

There are endpoints to query a particular user, but that seems horribly inefficient to say “hey, we want to do a push for these thousands of members, so let’s query them, one at a time, to see if they still have that entitlement.” There is a CSV download for customers, but that does not appear to have all the entitlements in it. (Also, that “CSV” is actually semicolon delimited. What’s up with that?)

So, bottom line, is there an endpoint that says “give me all the users entitled to entitlement x.” Or, better, and endpoint or download feature that fetches “for all entitlements, show me all users entitled to each entitlement”? How do we have our backend catch up on entitlements established earlier?


1 reply

Userlevel 3
Badge +7

Hi @Robert Ryan,

We’ve been using RevenueCat entitlements client-side with some success. That’s great.

We’re now trying to integrate this with our backend to control the nature of the push notifications we do and do not send (and/or what the content of that push notification is).

Yes, we have the webhook set up, and that works fine. But how do we sync our backend with the RevenueCat entitlements to, effectively, catch up on which users are already entitled? (I don’t really want to know the individual subscription/product for which people have signed up, just who is entitled to what.)

 

The way we currently recommend to sync your backend, for this purpose or any other is to your our webhooks as a trigger to call our API:

To simplify the logic of handling different webhook types, we recommend creating a polling system using the GET /subscribers REST API to sync the subscription status of the customer from RevenueCat to your database. Then, each webhook event can simply be a trigger to call this sync function. This approach has a few benefits and can make your system more robust and scalable.

 

There are endpoints to query a particular user, but that seems horribly inefficient to say “hey, we want to do a push for these thousands of members, so let’s query them, one at a time, to see if they still have that entitlement.” There is a CSV download for customers, but that does not appear to have all the entitlements in it. (Also, that “CSV” is actually semicolon delimited. What’s up with that?)

The previous recommendation should take care of the issue with the endpoints you mentioned (querying thousands at time). Also in this case, the ETL exports, which contain all of your transaction data (and entitlements) would work better than the customer lists.

 

So, bottom line, is there an endpoint that says “give me all the users entitled to entitlement x.” Or, better, and endpoint or download feature that fetches “for all entitlements, show me all users entitled to each entitlement”? How do we have our backend catch up on entitlements established earlier?

We don’t have an endpoint like that currently, and I don’t have an eta of when one might be available. However, we do have the next version of our API (V2) in the works to be released this year. It is specifically designed to help developers better achieve use cases like these, but no specific eta I can share at the moment. I hope this helps!

Reply