ScaffoldHub
Search
K

Subscriptions and Payments

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.

Subscription types

In the modeling tool, you can select between three different strategies of subscriptions:
Membership-based - The subscription is valid for a single tenant and user.
User-based - The subscription is valid for a single user across all tenants.
Tenant-based - The subscription is valid for all users of a tenant.

Subscribing

By default, there are three plans: Free, Basic, 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.

Managing Subscription

Users can cancel, upgrade, or downgrade a plan.
When users click Manage Subscription, they are redirected to the Stripe Customer Portal.

Upgrading or Downgrading a Subscription

When users upgrade or downgrade a plan on the customer portal, a webhook is triggered, and the application is updated.

Canceling a Subscription

When users cancel a plan, it is not canceled immediately because they paid for the entire period. The plan is marked to cancel at the end period and remains active until then.

Restricting access to features

Permissions for features must be configured in the code. It has some helper methods to assist you.
The code is under src/security.ts.

Restrictions for Workspaces and Admins (for Tenant-based mode)

The user who subscribed to the plan is the only one that can modify it

This prevents different users from making charges to other's credit cards.

Deleting a workspace, membership, or manager membership with an active subscription automatically cancels the subscription.

Tenant-based

For Tenant-based subscriptions, when you delete the tenant related to the subscription, the subscription is automatically canceled on Stripe.
Also, for Tenant-based, removing the manager - the user who signed up for the plan - from the tenant also cancels the membership. This is because other users can't manage a subscription from other users, even if the subscription is related to the entire tenant.

Membership-based

For Membership-based subscriptions, when you remove the member from the tenant, the subscription is automatically canceled on Stripe.

Customizing subscriptions

If you need to add or remove plans, you need to change those files:
src/env.server.ts- Add or remove the required environment variables for the plan.
.env- Add or remove the required environment variables for the plan.
src/features/subscription/subscriptionPaidPlans.ts - Add or remove the plan from the list.
src/translation/[lang]/[lang].ts - Add translations for the new plans.
Last modified 4mo ago