Skip to main content
A few Ledger reads give you everything for a complete billing page: the customer’s plan, credits, every feature’s balance and their history, plus a pricing table of your plans. Load the data from your backend, render it, and send each button to one Ledger call.

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 each billingInterval. A monthly/annual toggle shows the month plans or the year plans: an annual plan is its own plan. A one_off plan is a lifetime deal.
  • Describe each plan from its items: “500 messages a month, then 1¢ each” from included and overageUnitAmountCents; “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’s price.
  • 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

When the customer lands on your success URL, load the page again: grants land when Stripe’s webhook does, usually within seconds. Checkout and attach has the details, test cards and every attach error.

Rules

  • Resolve the signed-in user’s customerId on your server, never from a value the browser sends, so each customer reads and changes only their own billing.
  • Check the planId the browser sends against plans.items, and call attach from your backend.
  • Listing plans, features and packs needs a key with Catalog read access.