Skip to main content
Read-only hooks for the merchant catalog customers can see: the flat live-plan list, the active product catalog, the full public pricing matrix for one product, and the org’s branding. Customers only ever see active plans and products — draft, archived, and migrated rows never surface. Every hook returns isLoading: boolean and error: Error | null (see Introduction); the sections below list each hook’s specific returns.

usePlans

Returns the merchant’s live plans — the flat list from GET /v1/plans?status=active. Customers only ever see active plans (never draft, archived, or migrated). For a customer-facing pricing page with tiers, intervals, entitlements, credit packages, and addons, use usePricing instead. Parameters — none. Returns
  • plansPlan[] — the active plans, or [] while loading. Each plan:
string
Plan identifier.
string
Display name.
string
Stable slug.
string | null
Optional description.
boolean
Whether the plan is publicly listed.
Record<string, unknown>
Arbitrary merchant metadata.

useProducts

Returns the org’s active product catalog — read-only, from GET /v1/products?status=active. Customers only ever see live products; archived ones are tombstones and never surface. This also powers usePricing’s single-product auto-derive fallback: when there’s exactly one active product, a portal with no explicit productId self-resolves to it. Parameters — none. Returns
  • productsProduct[] — the active products, or [] while loading. Each product:
string
Product identifier.
string
Owning org.
string
Display name.
string
Stable slug.
string | null
Optional description.
string | null
Optional product image.
'active' | 'archived'
Always active from this hook.
Record<string, unknown>
Arbitrary merchant metadata.
string
ISO timestamp.
string
ISO timestamp.

usePricing

Returns the complete customer-facing catalog for one product from GET /v1/public/pricing/:productId: tiers, plans-per-tier (interval variants), entitlements, credit packages, addons, and a canonical top-level features[] row list for building a pricing matrix. The server filters to self-serve tiers automatically. This is the hook customer-facing pricing pages want — not usePlans, the flat live-plan list. Parameters
string
The product to load pricing for. Optional — when omitted, it’s derived in this order:
  1. Explicit arg — usePricing('prod_xxx')
  2. UnitPayConfig.productId (the escape hatch set on <UnitPayProvider>)
  3. The active subscription’s productId (the sub is the answer)
  4. A single-product org auto-resolves (useProducts() length === 1)
  5. Otherwise null → returns { pricing: null, isLoading: false, error: null } (multi-product org with no sub — pass productId explicitly)
While the derivation inputs (subscription, products) are still loading, isLoading stays true.
Returns
  • pricing — the PricingResponse matrix, or null when no product could be resolved / while loading:
string
Catalog display currency.
object
{ id, name, slug, description, imageUrl }.
PricingFeature[]
Canonical matrix row order — the union of every entitlement slug across every plan in every tier, sorted by displayOrder. Each row carries slug, name, eventName (billable metric, or null), and creditCurrencyId (wallet it debits, or null).
PricingTier[]
The pricing columns. Each tier carries plans[] (interval variants), addons[], creditPackages[], an entitlementBySlug lookup (branches on mode: unlimited / quota / rate), plus presentation flags (isPopular, isForeverFree, isSelfServe, isSalesLed, ctaLabel, intervals[]).

useBranding

Returns the customer-facing merchant identity for the current org — what the portal renders in its header instead of a hardcoded asset. Read-only, from GET /v1/branding, and cached aggressively since branding changes rarely. It’s managed in the merchant dashboard. Parameters — none. Returns
  • branding — the Branding object, or null while loading:
string
Merchant display name. Always present.
Merchant logo URL, or null if none uploaded.
string | null
Merchant website URL, or null if unset — powers the portal’s “Return to ” back-link.
Record<string, unknown> | null
Typed appearance/theme config (accents, CSS overrides), or null if unset.

See also

Checkout

Preview and start a subscription to a plan from the catalog.

Entitlements & gates

What each plan’s entitlements grant the customer at runtime.

Credits & wallets

The credit packages and wallets referenced by the pricing matrix.