ScaffoldHub has built-in payments for workspaces using Stripe.
Payments are optional, and you can enable them on the modeling tool.
Check the Setup > Payments with Stripe section for instructions on how to set up payments.
Check the Architecture > Payments sections for technical instructions on how to add or remove plans.
By default, there are three plans, Free, Growth, and Enterprise.
Each workspace starts on the Free plan.
When the User clicks on Subscribe, it opens the Stripe Checkout page.
After payment is successful, the application enables the Plan.
Users can cancel, upgrade, or downgrade a plan.
When users click on Manage Subscription, they are redirected to the Stripe Customer Portal.
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.
When a plan is enabled, its features are also enabled. It's explained in detail on Architecture > Payments.
On the demonstration, all paid plans enable the Premium entity.
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.