Load the page
The customer’s side
Match
featureId to features.items for each feature’s display name. Creating customers explains every field of the customer.
A customer on a free plan keeps currentPlan on that plan until a paid plan’s payment lands, so show “Confirming your payment” from a pending_checkout subscription.
The pricing table
plans.items lists your active plans, each with its price and what it includes:
Response
- Sort by
priceCents, within eachbillingInterval. A monthly/annual toggle shows themonthplans or theyearplans: an annual plan is its own plan. Aone_offplan is a lifetime deal. - Describe each plan from its items: “500 messages a month, then 1¢ each” from
includedandoverageUnitAmountCents; “Up to 3 projects” or “Unlimited projects” from a held item; “SSO” from a boolean item; “$10 a seat after 3” from a held item’sprice. - Label each button from the customer’s plan: “Current plan” for their own, “Upgrade” for pricier plans, “Downgrade” for cheaper ones, “Choose” when they have no plan or a free one.
- Packs (
packs.items) are one-time purchases of credits: show them beside the balance, as “Buy 500 credits for $10”.
Wire up the buttons
Rules
- Resolve the signed-in user’s
customerIdon your server, never from a value the browser sends, so each customer reads and changes only their own billing. - Check the
planIdthe browser sends againstplans.items, and callattachfrom your backend. - Listing plans, features and packs needs a key with Catalog read access.