Xzero UI
Pro library

Live checkoutPro

A subscription checkout whose summary recomputes as you edit, then glides to the centre and unfolds into a receipt.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/checkout-live
Live · keyboard ready

Use this as the paid signup or upgrade step of a SaaS app. Load plans, add-ons and tax rates from your billing provider, check coupons on your server through validateCoupon, and charge through onPay with your payment SDK; the preview simulates payment.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/checkout-live

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { CheckoutLive } from "@/components/xzero/blocks/checkout-live/checkout-live";

export function UpgradePage() {
  return (
    <CheckoutLive
      defaultPlan="team"
      defaultSeats={12}
      validateCoupon={code => fetch(`/api/coupons/${code}`).then(r => r.json())}
      onPay={async order => {
        const res = await fetch("/api/subscribe", { method: "POST", body: JSON.stringify(order) });
        if (!res.ok) throw new Error("Your card was declined. Try another card.");
      }}
    />
  );
}

API reference

CheckoutLive

A subscription checkout with a live order summary. Plan, seats, billing period, add-ons, coupon and country recompute every line and the tax as you edit, and every amount rolls to its new value. On success the form steps aside and the summary glides to the centre and unfolds into a receipt.

PropTypeDefaultDescription
plansPlan[]sample plansPlans with an id, name, monthly seat price in cents, and a short blurb.
addonsAddon[]sample add-onsOptional add-ons with a flat monthly price in cents.
countriesCountry[]sample countriesBilling countries with a tax rate, tax label, postal code pattern, and a hint shown when the postal code does not match.
defaultPlanPlanId"team"Plan selected on mount.
defaultSeatsnumber8Seats on mount, from 1 to 500.
defaultBilling"monthly" | "yearly""yearly"Billing period on mount.
defaultAddonsstring[]["support"]Add-on ids selected on mount.
yearlyDiscountnumber0.2Discount for yearly billing, from 0 to 1. Shown on the billing toggle.
currencystring"USD"ISO currency code used to format every amount.
validateCoupon(code: string) => CouponResult | Promise<CouponResult>sample rulesChecks a coupon. Return { ok: true, code, percent } or { ok: false, message }. The sample accepts LAUNCH20 and TEAM10.
onPay(order: CheckoutOrder) => void | Promise<void>–Charges the order. Throw an Error to show its message above the pay button. Without it the preview simulates payment and declines 4000 0000 0000 0002.
classNamestring–Extra class on the root.

Keyboard interactions

KeysAction
TabMoves through express pay, plan, seats, add-ons, fields and pay.
Arrow keysMove between plans inside the plan group.
EnterSubmits the form, or applies the coupon from the coupon field.
EscapeCloses the coupon field.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components