Solved

How to verify a user subscription in the backend without user accounts/authentication

  • 9 February 2024
  • 2 replies
  • 35 views

Badge

Hey,


I am very new to everything involving in-app purchases, so sorry if this is a somewhat confused question. I am building an app (iOS/macOS only) that involves making calls to some AI tools through a custom backend that I am building as well. 

 

I would love to not force users to create accounts at all, since purchases are done and identified through the user’s Apple ID anyways, so there’s no immediate need to. I could just let them use the app as anonymous users.

 

However, I need some way for the backend to know if an incoming request is made by a user with an active subscription. I searched online for quite a bit, but haven’t found this exact problem yet. 

 

From what I read in the documentation, there might be a way to do this, by sending the users App ID (generated by the RC SDK) to the backend on each request and have the backend call the RC API with that App ID to check the subscription status. I have not tested this because I am not at the stage of development yet. 

 

I just wanted to ask, if this is an approach that could work, and if it is fine to call the RC API on every backend request to check for the subscription status. 

 

Thanks a lot for any help! 

icon

Best answer by sharif 13 February 2024, 19:29

View original

2 replies

Userlevel 5
Badge +9

Hi @SwiftedMind,

From what I read in the documentation, there might be a way to do this, by sending the users App ID (generated by the RC SDK) to the backend on each request and have the backend call the RC API with that App ID to check the subscription status. I have not tested this because I am not at the stage of development yet. 

This would be a good way to do this. You can call our GET /subscribers endpoint rather frequently as it’s designed for this level of usage. I recommend to have some sort of cache so you’re not hitting the endpoint for the same user for every request they make for performance reasons - for example our SDK caches the API’s request for 5 minutes as it’s unlikely anything will change in our system in 5 minutes. Hitting your own database for the info will likely be quicker than our API.

Badge

Awesome, thanks a lot for the answer! :) Caching is also a good idea, I will do that

Reply