Payments are optional, and you can enable them on the modeling tool.
By default, there are three plans, Free, Growth, and Enterprise.
Each workspace starts on the Free plan.
After payment is successful, the application enables the Plan.
Users can cancel, upgrade, or downgrade a plan.
When users upgrade or downgrade a plan on the customer portal, a webhook is triggered, and the application is updated.
When users cancel a plan, it is not canceled immediately, because they paid for the full period. The plan is marked to cancel at the end period and remains active until then.
Permissions/Features can be configured by plan.
You can also restrict access to specific actions.
For example, if we change the demonstration code to enable the Free plan to read the Premium entity, free users will be able to see the Premium listing, but not to Create, Edit, or Delete records.
This avoids that different users make charges to other's credit cards.
Plans marked as cancel at the end period can be deleted, because there won't be any charges in the future for that plan.