# Checkout

> A one-page checkout with contact, delivery and payment beside a live order summary. Handles changed totals, sold-out items and unknown outcomes.

Canonical: https://hextaui.com/blocks/checkout
Last updated: 2026-10-29

## Overview

Checkout puts contact, delivery and payment on one page, with the order summary beside it on wide screens and folded above it on phones. Each step opens in place and turns into a short summary row when it’s done, so a finished checkout reads like a receipt: “Contact maya@example.com”, “Ship to 12 Mission St, San Francisco, CA 94110”, “Method Standard · Arrives Oct 26 – 28 · Free”. Change on any row reopens that step and moves focus to it. Signed-in customers skip contact and start at delivery with their default saved address.

Pass the cart and three callbacks: onGetRates(address), onEstimateTax(address) and onPlaceOrder(draft, payment). Rates and taxes load as soon as the address is complete, with a short pause while someone is typing, and the previous request is aborted through its signal when the address changes. The cheapest rate is picked for you, and the summary shows “Calculating…” rather than a stale number while new prices load.

onPlaceOrder gets a draft with the email, lines, addresses, chosen rate and the exact total the shopper saw, plus the payment request with a fresh idempotency key. Return succeeded with the order, declined with a code, requires_action for 3-D Secure, or changed when the server’s prices differ. A changed result never charges: the summary updates, a notice lists each change in plain words (“Ring vase is now $74, was $68.”) with the old total struck through, and the shopper presses Pay again at the new amount.

The page also handles the slow and strange cases. Pay can’t run twice, and the Change buttons lock while an order is placing. If onPlaceOrder doesn’t answer within 20 seconds, the page says it’s checking the status and polls onCheckStatus with the same idempotency key instead of offering to pay again. An item that sells out mid-checkout is taken out of the total and flagged until the shopper removes it or continues without it, and pressing Pay with gaps lists every problem in one linked summary.

## Installation

### Step 1: Get HextaUI Pro

One payment unlocks every block, including future ones. [See pricing](https://hextaui.com/pricing).

### Step 2: Add the Pro registry to components.json

```json title="components.json"
{
  "registries": {
    "@hextaui-pro": {
      "url": "https://hextaui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${HEXTAUI_PRO_TOKEN}"
      }
    }
  }
}
```

### Step 3: Add your token

Create a token on your [account page](https://hextaui.com/account) and put it in `.env.local` as `HEXTAUI_PRO_TOKEN`.

### Step 4: Add the block

```bash
npx shadcn@latest add @hextaui-pro/checkout
```

## Usage

### Stripe PaymentIntents with server actions

Pass Stripe’s PaymentElement as paymentElement so card details go straight to Stripe and never touch your server. onPlaceOrder calls elements.submit(), then a server action reprices the cart, returns a changed result if the total moved, or creates a PaymentIntent with the attempt’s idempotency key. confirmPayment handles 3-D Secure, and onCheckStatus asks the server about attempts that never answered.

```tsx
"use client"

import * as React from "react"

import type { Address } from "../address-form/address"
import type { Cart } from "../cart/cart"
import { Checkout } from "@/components/blocks/checkout/checkout"
import type {
  CheckoutAttempt,
  CheckoutDraft,
  OrderStatusResult,
  PlaceOrderResult,
  TaxEstimate,
} from "@/components/blocks/checkout/checkout-model"
import type { ShippingRate } from "../shipping-methods/shipping"

type PlacedOrder = { id: string; number: string }

type StripeError = {
  type: string
  code?: string
  decline_code?: string
  message?: string
}

type StripeElements = {
  submit: () => Promise<{ error?: StripeError }>
}

type Stripe = {
  confirmPayment: (options: {
    elements: StripeElements
    clientSecret: string
    redirect: "if_required"
    confirmParams: { return_url: string }
  }) => Promise<{ error?: StripeError; paymentIntent?: { id: string; status: string } }>
}

type Prepared =
  | { status: "ready"; orderId: string; clientSecret: string }
  | Extract<PlaceOrderResult<PlacedOrder>, { status: "changed" }>

type CheckoutActions = {
  getRates: (cartId: string, address: Address) => Promise<ShippingRate[]>
  estimateTax: (cartId: string, address: Address) => Promise<TaxEstimate>
  prepareOrder: (draft: CheckoutDraft, idempotencyKey: string) => Promise<Prepared>
  confirmOrder: (orderId: string) => Promise<OrderStatusResult<PlacedOrder>>
  orderStatus: (idempotencyKey: string) => Promise<OrderStatusResult<PlacedOrder>>
}

export function StripeCheckout({
  cart,
  stripe,
  elements,
  paymentElement,
  actions,
}: {
  cart: Cart
  stripe: Stripe
  elements: StripeElements
  paymentElement: React.ReactNode
  actions: CheckoutActions
}) {
  const placeOrder = async (
    draft: CheckoutDraft,
    request: { idempotencyKey: string }
  ): Promise<PlaceOrderResult<PlacedOrder>> => {
    const submitted = await elements.submit()
    if (submitted.error) {
      return { status: "declined", message: submitted.error.message }
    }

    const prepared = await actions.prepareOrder(draft, request.idempotencyKey)
    if (prepared.status === "changed") return prepared

    const { error } = await stripe.confirmPayment({
      elements,
      clientSecret: prepared.clientSecret,
      redirect: "if_required",
      confirmParams: {
        return_url: `${window.location.origin}/checkout/return?order=${prepared.orderId}`,
      },
    })
    if (error?.type === "card_error" || error?.type === "validation_error") {
      return {
        status: "declined",
        code: error.decline_code ?? error.code,
        message: error.message,
      }
    }
    if (error) throw new Error(error.message ?? "We couldn’t reach Stripe. Nothing was charged.")

    const confirmed = await actions.confirmOrder(prepared.orderId)
    if (confirmed.status === "pending") return new Promise(() => {})
    return confirmed
  }

  return (
    <Checkout<PlacedOrder>
      cart={cart}
      paymentElement={paymentElement}
      onGetRates={(address) => actions.getRates(cart.id, address)}
      onEstimateTax={(address) => actions.estimateTax(cart.id, address)}
      onPlaceOrder={placeOrder}
      onCheckStatus={(attempt: CheckoutAttempt) =>
        actions.orderStatus(attempt.idempotencyKey)
      }
      onComplete={(order) => {
        if (order) window.location.assign(`/orders/${order.id}`)
      }}
    />
  )
}
```

### Shopify checkout handoff

On Shopify, orders and payments go through Shopify’s hosted checkout, so don’t rebuild it: send the email and address to the cart with cartBuyerIdentityUpdate and cartDeliveryAddressesAdd, then open checkoutUrl. Use this block when you take payment yourself, for example on Stripe, Adyen or Medusa.

```tsx
"use client"

import * as React from "react"

import { Button } from "@/components/ui/button"

import type { Address } from "../address-form/address"

type ShopifyCart = {
  id: string
  checkoutUrl: string
  cost: { totalAmount: { amount: string; currencyCode: string } }
}

type Storefront = <T>(query: string, variables: Record<string, unknown>) => Promise<T>

type UserErrors = { userErrors: { field: string[] | null; message: string }[] }

const buyerIdentity = `
  mutation cartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {
    cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
      cart { id checkoutUrl }
      userErrors { field message }
    }
  }
`

const deliveryAddress = `
  mutation cartDeliveryAddressesAdd($cartId: ID!, $addresses: [CartSelectableAddressInput!]!) {
    cartDeliveryAddressesAdd(cartId: $cartId, addresses: $addresses) {
      cart { id }
      userErrors { field message }
    }
  }
`

function toShopifyAddress(address: Address) {
  const [firstName, ...rest] = address.name.trim().split(/\s+/)
  return {
    firstName,
    lastName: rest.join(" "),
    company: address.company,
    address1: address.line1,
    address2: address.line2,
    city: address.city,
    provinceCode: address.region,
    zip: address.postalCode,
    countryCode: address.country,
    phone: address.phone,
  }
}

export function ShopifyCheckoutButton({
  cart,
  storefront,
  customer,
}: {
  cart: ShopifyCart
  storefront: Storefront
  customer?: { email: string; address?: Address } | null
}) {
  const [error, setError] = React.useState<string | null>(null)

  const handoff = async () => {
    setError(null)
    try {
      if (customer) {
        const identity = await storefront<{ cartBuyerIdentityUpdate: UserErrors }>(
          buyerIdentity,
          {
            cartId: cart.id,
            buyerIdentity: {
              email: customer.email,
              countryCode: customer.address?.country,
            },
          }
        )
        const problem = identity.cartBuyerIdentityUpdate.userErrors[0]
        if (problem) throw new Error(problem.message)
      }
      if (customer?.address) {
        await storefront<{ cartDeliveryAddressesAdd: UserErrors }>(deliveryAddress, {
          cartId: cart.id,
          addresses: [
            {
              address: { deliveryAddress: toShopifyAddress(customer.address) },
              selected: true,
            },
          ],
        })
      }
      window.location.assign(cart.checkoutUrl)
      await new Promise(() => {})
    } catch (caught) {
      setError(
        caught instanceof Error && caught.message
          ? caught.message
          : "We couldn’t open checkout. Try again."
      )
    }
  }

  return (
    <div className="flex flex-col gap-2">
      <Button size="lg" className="w-full" feedback onClick={handoff}>
        Check out
      </Button>
      {error ? (
        <p role="alert" className="text-sm text-destructive">
          {error}
        </p>
      ) : null}
    </div>
  )
}
```

### Medusa cart completion

Rates come from listCartOptions after the address is saved, and taxes from the cart’s tax_total. onPlaceOrder adds the shipping method, compares Medusa’s total with the one the shopper saw and returns a changed result with the line, shipping and tax differences, then starts a payment session and completes the cart.

```tsx
"use client"

import type * as React from "react"

import type { Address } from "../address-form/address"
import type { Cart } from "../cart/cart"
import { compareMoney, money, type Money } from "../price/money"
import type { ShippingRate } from "../shipping-methods/shipping"
import { Checkout } from "@/components/blocks/checkout/checkout"
import type {
  CheckoutChange,
  CheckoutDraft,
  PlaceOrderResult,
} from "@/components/blocks/checkout/checkout-model"

type MedusaAddress = {
  first_name: string
  last_name: string
  company?: string
  address_1: string
  address_2?: string
  city: string
  province?: string
  postal_code?: string
  country_code: string
  phone?: string
}

type MedusaCart = {
  id: string
  currency_code: string
  total: number
  tax_total: number
  shipping_total: number
  items: {
    id: string
    title: string
    product_title: string
    variant_id: string
    product_id: string
    quantity: number
    unit_price: number
    thumbnail: string | null
  }[]
}

type MedusaOrder = { id: string; display_id: number }

type MedusaSdk = {
  store: {
    cart: {
      update: (
        id: string,
        body: { email?: string; shipping_address?: MedusaAddress; billing_address?: MedusaAddress }
      ) => Promise<{ cart: MedusaCart }>
      addShippingMethod: (id: string, body: { option_id: string }) => Promise<{ cart: MedusaCart }>
      complete: (
        id: string
      ) => Promise<
        | { type: "order"; order: MedusaOrder }
        | { type: "cart"; cart: MedusaCart; error: { message: string } }
      >
    }
    fulfillment: {
      listCartOptions: (query: { cart_id: string }) => Promise<{
        shipping_options: { id: string; name: string; amount: number }[]
      }>
    }
    payment: {
      initiatePaymentSession: (
        cart: MedusaCart,
        body: { provider_id: string }
      ) => Promise<{ payment_collection: { payment_sessions: { id: string; data: Record<string, unknown> }[] } }>
    }
  }
}

function toMedusaAddress(address: Address): MedusaAddress {
  const [first, ...rest] = address.name.trim().split(/\s+/)
  return {
    first_name: first ?? "",
    last_name: rest.join(" "),
    company: address.company,
    address_1: address.line1,
    address_2: address.line2,
    city: address.city,
    province: address.region,
    postal_code: address.postalCode,
    country_code: address.country.toLowerCase(),
    phone: address.phone,
  }
}

function toCart(cart: MedusaCart): Cart {
  const currency = cart.currency_code.toUpperCase()
  return {
    id: cart.id,
    currencyCode: currency,
    lines: cart.items.map((item) => ({
      id: item.id,
      quantity: item.quantity,
      price: money(item.unit_price, currency),
      merchandise: {
        id: item.variant_id,
        productId: item.product_id,
        productTitle: item.product_title,
        variantTitle: item.title,
        image: item.thumbnail
          ? { id: item.thumbnail, src: item.thumbnail, alt: "" }
          : undefined,
      },
    })),
  }
}

function changesBetween(draft: CheckoutDraft, cart: MedusaCart): CheckoutChange[] {
  const currency = cart.currency_code.toUpperCase()
  const changes: CheckoutChange[] = []
  for (const line of draft.lines) {
    const item = cart.items.find((entry) => entry.id === line.id)
    if (!item) {
      changes.push({ type: "sold_out", lineId: line.id, title: line.merchandise.productTitle })
      continue
    }
    const price = money(item.unit_price, currency)
    if (compareMoney(price, line.price) !== 0) {
      changes.push({ type: "price", lineId: line.id, title: item.product_title, from: line.price, to: price })
    }
    if (item.quantity !== line.quantity) {
      changes.push({ type: "quantity", lineId: line.id, title: item.product_title, from: line.quantity, to: item.quantity })
    }
  }
  const shipping = money(cart.shipping_total, currency)
  if (compareMoney(shipping, draft.shippingRate.price) !== 0) {
    changes.push({ type: "shipping", from: draft.shippingRate.price, to: shipping })
  }
  return changes
}

type PaymentSession = { id: string; data: Record<string, unknown> }

export function MedusaCheckout({
  sdk,
  cart,
  providerId = "pp_stripe_stripe",
  paymentElement,
  confirmPayment,
  onPlaced,
}: {
  sdk: MedusaSdk
  cart: MedusaCart
  providerId?: string
  paymentElement: React.ReactNode
  confirmPayment: (session: PaymentSession) => Promise<{ declined?: string } | void>
  onPlaced: (order: MedusaOrder) => void
}) {
  const currency = cart.currency_code.toUpperCase()
  const taxes = new Map<string, Money>()

  const placeOrder = async (draft: CheckoutDraft): Promise<PlaceOrderResult<MedusaOrder>> => {
    await sdk.store.cart.update(cart.id, {
      email: draft.email,
      shipping_address: toMedusaAddress(draft.shippingAddress),
      billing_address: toMedusaAddress(draft.billingAddress),
    })
    const { cart: priced } = await sdk.store.cart.addShippingMethod(cart.id, {
      option_id: draft.shippingRate.id,
    })

    if (compareMoney(money(priced.total, currency), draft.total) !== 0) {
      const changes = changesBetween(draft, priced)
      const estimated = taxes.get(cart.id)
      const tax = money(priced.tax_total, currency)
      if (estimated && compareMoney(estimated, tax) !== 0) {
        changes.push({ type: "tax", from: estimated, to: tax })
      }
      return {
        status: "changed",
        changes,
        cart: toCart(priced),
        shipping: money(priced.shipping_total, currency),
        tax,
      }
    }

    const { payment_collection } = await sdk.store.payment.initiatePaymentSession(priced, {
      provider_id: providerId,
    })
    const session = payment_collection.payment_sessions[0]
    if (session) {
      const confirmed = await confirmPayment(session)
      if (confirmed?.declined) return { status: "declined", message: confirmed.declined }
    }
    const completed = await sdk.store.cart.complete(cart.id)
    if (completed.type === "cart") {
      return { status: "declined", message: completed.error.message }
    }
    return { status: "succeeded", order: completed.order }
  }

  return (
    <Checkout<MedusaOrder>
      cart={toCart(cart)}
      paymentElement={paymentElement}
      onGetRates={async (address) => {
        await sdk.store.cart.update(cart.id, { shipping_address: toMedusaAddress(address) })
        const { shipping_options } = await sdk.store.fulfillment.listCartOptions({
          cart_id: cart.id,
        })
        return shipping_options.map(
          (option): ShippingRate => ({
            id: option.id,
            title: option.name,
            price: money(option.amount, currency),
            delivery: { businessDays: [3, 5] },
            kind: "ship",
          })
        )
      }}
      onEstimateTax={async (address) => {
        const { cart: updated } = await sdk.store.cart.update(cart.id, {
          shipping_address: toMedusaAddress(address),
        })
        const tax = money(updated.tax_total, currency)
        taxes.set(cart.id, tax)
        return tax
      }}
      onPlaceOrder={placeOrder}
      onComplete={(order) => {
        if (order) onPlaced(order)
      }}
    />
  )
}
```

## Anatomy

The parts you compose, from the outside in.

| Part | Description |
| --- | --- |
| `Checkout` | The full page: header, steps, express wallets, the three sections, payment and the order summary. |
| `useCheckout` | The state behind the page, for building your own layout: steps, address, rates, taxes, totals and order placement. |
| `StepIndicator` | Contact, Delivery and Payment as a breadcrumb. Finished steps get a check and reopen on click. |
| `SummaryList, SummaryRow` | The receipt rows a finished step collapses into, each with a Change action. |
| `SoldOutNotice` | Lists sold-out lines with Remove and Continue without it. |
| `ChangedNotice` | Explains a changed order and shows the new total next to the old one. |
| `ErrorSummary` | One alert that links to every problem stopping payment. |
| `UnknownNotice, SlowBanner` | Status while the outcome is unknown, and a note when the network is slow. |
| `describeChange, CheckoutChangedError` | Plain-language copy for a change, and the error Checkout raises for a changed result. |

## API reference

### Checkout

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `cart` | `Cart` | – | The cart being bought. Lines with soldOut: true are left out of the total and flagged. |
| `onGetRates` | `(address: Address, context: { signal: AbortSignal }) => Promise<ShippingRate[]>` | – | Loads delivery options for a complete address. Throwing shows the message with a retry. |
| `onEstimateTax` | `(address: Address, context: { signal: AbortSignal }) => Promise<Money \| { amount, included?, basis? } \| null>` | – | Estimates tax for the address. Leave it out when prices include tax. |
| `onPlaceOrder` | `(draft: CheckoutDraft, payment: CheckoutPaymentRequest) => Promise<PlaceOrderResult<TOrder>>` | – | Places the order. Return succeeded, declined, requires_action or changed. Throwing shows the message at the payment step. |
| `onCheckStatus` | `(attempt: CheckoutAttempt) => Promise<PlaceOrderResult<TOrder> \| { status: "pending" }>` | – | Asked every pollInterval once onPlaceOrder has been silent for timeout. The attempt carries the idempotency key and how many checks have run. |
| `onComplete` | `(order: TOrder \| null) => void` | – | Called after the success check has held. Navigate to your confirmation page here. |
| `onExpress` | `(method: ExpressMethod, context: { cart, total, idempotencyKey }) => Promise<PlaceOrderResult<TOrder>>` | – | Runs a wallet payment. Wallet buttons only show when this and expressMethods are set. |
| `onRemoveLine` | `(lineId: string) => Promise<Cart \| void> \| Cart \| void` | – | Removes a sold-out line. Without it the notice only offers Continue without it. |
| `onApplyCode, onRemoveCode` | `(code: string) => Promise<Cart \| void> \| Cart \| void` | – | Discount code handlers for the order summary. Return the updated cart. |
| `customer` | `{ email: string; name?: string; addresses?: SavedAddress[]; cards?: SavedCard[] } \| null` | – | The signed-in customer. Skips contact and offers saved addresses and cards. |
| `onSignIn, onSignOut` | `() => void` | – | Shows “Have an account? Sign in” for guests and Sign out on the contact row. |
| `defaultEmail` | `string` | `""` | Prefills the email for guests. |
| `defaultAddress` | `Partial<Address>` | – | Prefills the shipping address. |
| `defaultCountry` | `string` | `"US"` | Country of the empty address forms. |
| `expressMethods` | `("apple_pay" \| "google_pay" \| "shop_pay" \| "paypal")[]` | – | Wallet buttons above the steps. |
| `paymentMethods` | `("card" \| "paypal" \| "bnpl" \| "apple_pay" \| "google_pay")[]` | `["card", "paypal", "bnpl"]` | Methods in the payment step. |
| `paymentElement` | `ReactNode` | – | Your processor’s hosted fields, such as Stripe’s PaymentElement, shown instead of the built-in methods. Pay then sends a request with method: "element" and no card data. |
| `payment` | `{ bnpl?, renderChallenge?, today?, successDelay?, labels? }` | – | Options passed to the Payment block, including renderChallenge for your 3-D Secure step. |
| `addressForm` | `{ countries?, phone?, onSearchAddress?, onResolveAddress?, onLookupPostalCode? }` | – | Options passed to both address forms, including address autocomplete. |
| `storeName` | `ReactNode` | `"Halden"` | The name in the header. |
| `storeHref` | `string` | – | Makes the store name a link back to the shop. |
| `onStoreClick` | `() => void` | – | Called on a plain click of the store name instead of following storeHref, for client-side routers. Modified clicks still open the link. |
| `footer` | `ReactNode` | – | Policy links under the payment step. |
| `slowAfter` | `number` | `4000` | Milliseconds before the slow-network note shows for rates or the order. |
| `timeout` | `number` | `20000` | Milliseconds of silence from onPlaceOrder before polling onCheckStatus. |
| `pollInterval` | `number` | `3000` | Milliseconds between status checks. |
| `addressDelay` | `number` | `450` | Pause after typing before rates and taxes load. Saved addresses load at once. |
| `locale` | `Intl.LocalesArgument` | `"en-US"` | Formats prices and dates. |
| `labels` | `Partial<CheckoutLabels>` | – | Overrides any text on the page. |

### useCheckout

useCheckout(options) takes the same data and callbacks as Checkout and returns the state and actions it renders from.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `section, completed` | `"contact" \| "delivery" \| "payment", { contact: boolean; delivery: boolean }` | – | The open step and which steps are done. |
| `open, advance` | `(section) => boolean, (from) => section` | – | Reopen a step, or mark one done and move to the next. open returns false while an order is placing. |
| `email, setEmail, marketing, setMarketing` | `string, boolean and setters` | – | The contact step. |
| `addressDraft, setAddressDraft, savedAddressId, selectSavedAddress, shippingAddress` | `Address and setters` | – | The delivery address. shippingAddress is null until it’s complete. |
| `rates, rate, selectRate, retryRates` | `RatesState, ShippingRate \| undefined, functions` | – | Rates for the current address and the chosen one. |
| `totals, total, shipping, summaryTax` | `SummaryTotals, Money, …` | – | Everything the order summary shows, after overrides from a changed result. |
| `cart, summaryCart, flaggedLines, removeLine, continueWithout` | `Cart, Cart, CartLine[], functions` | – | The cart, the cart without sold-out lines, and the sold-out lines still waiting for a decision. |
| `placement, busy, slow` | `PlacementState, boolean, "rates" \| "order" \| null` | – | Order phase (idle, placing, unknown, changed, succeeded), whether editing is locked, and what is slow. |
| `placeOrder, placeExpress` | `(request) => Promise<PaymentResult>` | – | Place the order once. A second call while one is running returns the same promise. A changed result rejects with CheckoutChangedError. |
| `draft` | `() => CheckoutDraft \| null` | – | The draft onPlaceOrder will get, or null while something is missing. |
| `finish` | `() => void` | – | Calls onComplete with the placed order. |

### StepIndicator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `section` | `CheckoutSection` | – | The current step, marked aria-current="step". |
| `completed` | `{ contact: boolean; delivery: boolean }` | – | Steps that get a check. |
| `canOpen` | `(section) => boolean` | – | Whether a step is a button. |
| `onOpen` | `(section) => void` | – | Called when a step is clicked. |
| `labels, label` | `Record<CheckoutSection, string>, string` | – | Step names and the nav label. |

### SummaryRow

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | – | The row label, such as Contact or Method. |
| `children` | `ReactNode` | – | The value. |
| `action, actionLabel, onAction` | `string, string, () => void` | – | The Change button, its accessible name and handler. |
| `disabled` | `boolean` | – | Locks the action, for example while an order is placing. |

### SoldOutNotice

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `lines` | `CartLine[]` | – | Sold-out lines. The notice folds away when empty. |
| `removing` | `string \| null` | – | The line being removed. |
| `error` | `{ lineId: string; message: string } \| null` | – | A failed removal, shown under its line. |
| `canRemove` | `boolean` | – | Shows Remove next to Continue without it. |
| `onRemove, onContinue` | `(lineId: string) => void` | – | The two choices. |

### ChangedNotice

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `changes` | `CheckoutChange[]` | – | Each change, written out with describeChange. |
| `previousTotal` | `Money \| null` | – | The total the shopper tried to pay, struck through. |
| `total` | `Money` | – | The new total. |
| `onDismiss` | `() => void` | – | Adds a Got it button. |

### ErrorSummary

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | `"There is a problem"` | The heading. |
| `entries` | `{ id: string; message: string; onSelect: () => void }[]` | – | One link per problem. onSelect opens and focuses the field. |

### describeChange

describeChange(change, { locale }) returns a sentence such as “Only 2 Stoneware cup left, so we changed your quantity from 4 to 2.”

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `change` | `{ type: "price" \| "quantity" \| "sold_out" \| "shipping" \| "tax" \| "discount"; … }` | – | One entry from a changed result. |

## Keyboard

| Key | Action |
| --- | --- |
| `Tab` | Move through the open step, then the summary rows and their Change buttons. |
| `Enter` | Continue to delivery from the email field. |
| `↑` `↓` | Move between saved addresses, delivery options and payment methods. |
| `Space` | Toggle the marketing and billing checkboxes. |
| `Enter` | Follow a link in the error summary to the field it names. |

## Accessibility

- Each step is a section labelled by its heading, and the breadcrumb marks the current one with aria-current="step". When a step opens, finishes or is reopened with Change, focus moves to its heading or first field, so keyboard and screen reader users land where the content changed. Programmatic focus never draws a focus ring; only keyboard focus does.
- Closed steps are inert, so Tab never reaches hidden fields. Change buttons name what they change, such as “Change contact” and “Change ship to address”.
- Pressing Pay with problems shows one alert that lists them as links and takes focus. A changed order and a decline are alerts that take focus, pressing Pay with a sold-out item moves focus to its notice, and loading rates, a removed item and the status check are announced politely.
- Inputs are 16px on touch screens, buttons are 48px tall on touch, steps fold with a short height and fade transition that turns off with reduced motion, and status text never shifts the layout.

## Built with

The free HextaUI components Checkout is made from. Each one installs on its own.

- [Badge](https://hextaui.com/docs/badge) - Status labels with colored dots, removable tags that slide closed and counts that roll to their new value.
- [Button](https://hextaui.com/docs/button) - Buttons in every variant and size, with a built-in loading, success and error flow that skips the spinner for fast requests.
- [Checkbox](https://hextaui.com/docs/checkbox) - A checkbox whose check draws in, with indeterminate parents, groups and labels that share its hover.
- [Field](https://hextaui.com/docs/field) - Labels, descriptions and errors wired to their control, with validation states and layouts for forms.
- [Input](https://hextaui.com/docs/input) - A text input with three sizes, invalid and read-only states, native validation styling and a 16px touch font so phones never zoom in.
- [Spinner](https://hextaui.com/docs/spinner) - A loading indicator with Apple-style ticks or a breathing ring that can wait before showing and stay long enough not to flicker.

## Code

7 files, added to components/blocks/checkout.
