Skip to content
caliper ui pro docs

Payment methods

The cards on an account and a form to add one: brand detected as you type, the number checked before sending, expiry warnings, a bank confirmation step, and a default that cannot be removed by accident.

Pro

Payment methods

  • Visa ending 4242Expires 08/28Default
  • Mastercard ending 4444Expires 11/26 · update it before then

When to use

  • Billing settings.
  • Any account that keeps a card on file.

When not to use

  • A one-off checkout; use the checkout form.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/payment-methods

Adds its 11 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

API reference

cardBrand

0 props

No props of its own; it accepts the native props of its root element.

luhn

0 props

No props of its own; it accepts the native props of its root element.

PaymentMethods

8 props
PropTypeDefaultDescription
cards *readonly SavedCard[]—
todaystringnew Date().toISOString().slice(0, 10)
countriesreadonly { value: string; label: string; }[][{ value: "PT", label: "Portugal" }, { value: "GB", label: "United Kingdom" }, { value: "DE", label: "Germany" }, { value: "US", label: "United States" }]
onAdd *(card: NewCard) => Promise<AddCardResult>—Send the card to your payment provider. Return what happened; throw to show an error.
onConfirmAction(() => Promise<SavedCard>)—Called when the cardholder says they approved it in their bank app.
onSetDefault((id: string) => void | Promise<void>)—
onRemove((id: string) => void | Promise<void>)—
classNamestring—

Keyboard

  • Keyboard and focus come from Radix popover: arrow keys move through items, Enter and Space select, and Escape closes and returns focus.

Accessibility

It exposes group, alert and status semantics, with aria-hidden, aria-labelledby, aria-label and aria-disabled kept in step with state. Changes that matter are announced through a live region.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/payment-methods.md

The index of every part is at /llms.txt.

More in Billing