How to design plans and entitlements your code can check
A pricing page is a promise in words. Your product needs the same promise as data: a list of features and limits per plan that every part of the app reads from one place.
6 min read · Last checked
In short
Key points
- Gate on features and limits, never on plan names. Code that asks "is this the Pro plan?" breaks the first time you add a plan.
- Name each feature once and use that name everywhere: pricing page, code and support.
- Decide what happens at a limit, on a downgrade and when a trial ends before you launch.
- Make plan changes configuration, so pricing experiments do not need a release.
Start from what customers value, not from what is easy to count
The best limits track the value a customer gets: projects managed, messages sent, people who work in the product. Limits that track your costs but not their value feel arbitrary, and customers resent them. Pick one or two main limits per plan and keep the rest as simple on-or-off features.
Gate on features, not plan names
Give every gated capability a stable key, such as reports or api_access, and ask whether the current customer has that feature. Plans then become lists of keys and numbers. When you add a plan, retire one, or move a feature up a tier, no application code changes.
var context = await te.GetRuntimeContextAsync("my-app", "Production", tenantId, ct);
if (context is null || !context.Features.Contains("reports"))
return Results.StatusCode(StatusCodes.Status403Forbidden);Decide the edge cases before launch
- At a limit: block, allow with a warning, or allow and bill for the overage? Say which on the pricing page.
- On a downgrade: what happens to data or projects above the new limit? Read-only is usually kinder than deletion.
- When a trial ends: which plan does the customer land on, and do they keep their data?
- When a payment fails: how long is there before access changes, and who is told?
Tell customers where they stand
Show current usage against each limit inside the product, and warn before a limit is reached. TenancyEngine sends a usage.near_limit event at 80 percent of a limit and a usage.at_limit event at 100 percent, once for each crossing, so you can show a banner or send an email at the right time.
How this maps to TenancyEngine
In TenancyEngine you define features, roles and plans once. The runtime context returns the features and limits that apply to one customer, together with current usage and status. Plans can include trial periods and scheduled changes, and the platform reports when the next change is due, so your cache expires in time. Because plans are data, the same definitions drive the pricing page, checkout and the checks in your backend.
Honest limits
What to know before you rely on this
- Starter has no subscription billing. Charging for plans starts on Growth.
- TenancyEngine does not decide your prices or limits. It stores them and enforces what you define.
Questions people ask
How many plans should I launch with?
Few. Two or three plans are enough to learn what customers value, and plans defined as data are easy to add to later.
Where should limit checks live in my code?
In one place, such as middleware or a service that every metered action calls, so a limit cannot be bypassed by a new endpoint.
Sources
Keep reading
Try it on the free plan
One app and five customers, no credit card required.