I have a question on SaaS' payment handling. Say, you have a SaaS product and you want to restrict access or amount of something depending on the selected plan.
For example, if a user is on a free plan he can create only one item, if "pro" - up to 10 etc. The same about the restrictions on some functionality (features).
When you use this approach you restrict your interface's elements, as well as back-end endpoints.
So, the question is now: how do you check the account's state? I see 2 approaches here:
- Use hooks from the payment's system. For example, if a user paid on time your hook will grab the user's id and set his account to "valid" or so. When the next time the user will try to create one more item, you will check his account, see "valid" there and allow (or "invalid" and disallow).
- Check the user's account's state (in a payment system) every time when a user tries to do something that can be restricted. You don't rely on your database (as it may be outdated) and just make call for payment's system endpoints which returns you some information about the user's account and you make a decision based on this information.
Which approach do you use and why?