we are working on a flutter app that uses firebase authentication and each user has his own unique user id , first we setup the revenuecat on the lunch of the app using this
await Purchases.setup("public_sdk_key"); secondly when the user logs in we use its unique user id in :
await Purchases.logIn(uuid); thirdly and when the user logs out we use await Purchases.logOut(); is this the best practice and how can we handle if the user terminated his subscription while using the app
That setup sounds correct! You should inspect the PurchaserInfo object to determine if the subscription for the user is still active. You won’t get pushed information if the subscription expires in the middle of app-usage, but the next time you call .getPurchaserInfo() or restart the app the latest PurchaserInfo object will be fetched.
The .getPurchaserInfo() call operates on a 5-minute cache, so you can call this as frequent as you’d like without worrying about rate limits, still knowing that the information won’t be more than a few minutes behind.
That setup sounds correct! You should inspect the PurchaserInfo object to determine if the subscription for the user is still active. You won’t get pushed information if the subscription expires in the middle of app-usage, but the next time you call .getPurchaserInfo() or restart the app the latest PurchaserInfo object will be fetched.
The .getPurchaserInfo() call operates on a 5-minute cache, so you can call this as frequent as you’d like without worrying about rate limits, still knowing that the information won’t be more than a few minutes behind.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.