Question

Should I check user subscribe status via customerInfo in client or cloud funtion

  • 18 September 2023
  • 2 replies
  • 20 views

Badge

Hi Revenuecat team, I am new flutter developer and use firestore as my server, my question is for my flutter app I want to check user’s subscription status, so I can get it via

CustomerInfo customerInfo = await Purchases.getCustomerInfo();

Should I then pass this value

customerInfo.entitlements.all[entitlementID]?.isActive

directly to my cloud function to calculate different methods based on user’s subscription status, or I need to move revenuecat code part in cloud function, in case someone can hack my code and always pass TRUE value to my cloud function? Thanks! 


2 replies

Userlevel 1
Badge +3

Hi,

Happy to help here. Yeah, I would definitely either pass that method into your backend, or use one of firestore’s authentication methods to do this. You’re right that just sending a boolean from the SDK could be insecure if someone took apart your code.

Badge

hi Ryan, many thx for the reply, sry I am new to Revenuecat world, since I just found this introduction https://www.revenuecat.com/docs/customer-info which tells me how to check subscribe status in client, but not in backend with cloud function via using typescript, not to mention is it possible to configure Revenuecat in cloud function?

If I want to check through Firestore, do you mean to check Collection(customers) → Document(userID) → Collection(subscriptions/myProduct/) and then compare to expire_date there? Or there is a better way or some tutorial that I did not find yet in Revenuecat’s document page?

Reply