Pricing table and upgrade view
Show your plans to your customers, or to visitors who are not customers yet, as a ready-made pricing table. For a signed-in customer it highlights their current plan and shows an Upgrade button on plans that cost more. The table lists your active plans, their monthly price, and the features each plan includes with their limits.
The table never takes a payment and never starts a checkout. Each button opens your own page with the plan appended, and your page decides how the customer buys. That keeps how you sell, and what you charge, in your hands. If you do not give an upgrade page, the table shows no buttons.
How it works
- Your backend asks TenancyEngine for a pricing token. The token is read-only, valid for one app (and optionally one customer), and expires after 15 minutes.
- Your page shows the hosted pricing table in an iframe with that token.
- The table loads your plans with the token. Nothing else can be read with it, and no cookies are involved.
Mint a fresh token for each page view. Do not store it or log it. A token from the Plan and usage widget does not work here, and the other way round.
1. Mint a token (your backend)
For a signed-in customer, name the customer. The call needs an organization API key with the tenants.read scope.
POST /api/v1/runtime/applications/{app}/paywall/token?environment=Production
X-TenancyEngine-Api-Key: te_...
Content-Type: application/json
{ "tenantSlug": "acme", "upgradeUrl": "https://my-app.example/billing/upgrade" }For a public pricing page, leave out tenantSlug. That call needs the applications.read scope instead.
{
"token": "CfDJ8...",
"expiresAtUtc": "2026-10-17T12:15:00Z",
"expiresInSeconds": 900,
"embedUrl": "https://auth.example.com/api/v1/public/paywall/frame#token=CfDJ8...",
"dataUrl": "https://auth.example.com/api/v1/public/paywall/data"
}The upgrade page
upgradeUrl must be an https URL (plain http is accepted only for localhost) with no credentials and no #fragment. The table adds offering={planSlug} to it, and tenant={tenantSlug} when the token names a customer, so your page can start the right checkout.
- A customer sees Upgrade to {plan} on plans priced above their current plan, and Your current plan on theirs.
- Cheaper plans show no button. A customer moves down by contacting you.
- A visitor with no customer sees Choose {plan} on every plan.
2. Show it
<iframe src="{embedUrl}" title="Plans and pricing" style="width:100%;border:0"></iframe>The frame sizes itself to its content: it posts { type: "tenancyengine:paywall:height", height } to the parent page, so you can resize the iframe. It follows the visitor's light or dark setting and uses the customer's brand colour and logo when set. Add &theme=dark or &theme=light after the token in the URL fragment to force a theme.
As an upgrade dialog
Open the same embedUrl inside your own dialog when a customer hits a limit. Pass the feature or limit that blocked them to your upgrade page as you like; the table itself only shows your plans. To pick the right plan for a limit, call GET /api/v1/runtime/applications/{app}/tenants/{tenant}/usage/upgrade-options/{featureKey}?environment=Production first. It lists the plans that unlock that feature or a higher limit, cheapest first, and you can send the customer straight to the first one.
Good to know
- The table shows up to 8 active plans, cheapest first. Plans that are switched off are not shown.
- A feature appears only if your app still defines it and has it switched on.
- Prices are your plans' monthly prices in US dollars. Country-specific prices are not shown yet.
- Works at 200% browser zoom: layout wraps and every size is in
rem. - The table never changes anything and cannot read usage, customers or billing details.