Checkout
Tax resolved before the button, a discount code, and a slot for your processor's card field.
PROGet Checkout and 168 other Pro components with pro lifetime — Get Pro
- Category
- Billing
- Access
- ProPro · unlocked
- Source
- 623 lines · one file
The decision inside it
Tax before Pay, not after the charge
Choosing a country resolves the tax line while Pay waits, so the figure on the button is the figure on the statement. The component never sees a card number, that field belongs to your processor.
When to use it
Use Checkout for a paid sign-up: plan summary, email and company, country with tax worked out by your resolveTax, a discount code and a slot for your payment processor's card field. Prices are in cents.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Checkout for this.
Install it: npx shadcn@latest add @liro/checkout-form
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/checkout-form.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { CheckoutForm } from "@/components/ui/checkout-form";
export function Checkout({ pay }: { pay: (details: { email: string; country: string; total: number }) => Promise<void> }) {
return (
<CheckoutForm
plan={{ name: "Team", price: 8900, interval: "month" }}
countries={[{ code: "IE", name: "Ireland" }, { code: "US", name: "United States" }]}
resolveTax={async (country) => (country === "IE" ? { name: "VAT", rate: 0.23 } : null)}
nextChargeOn="14 Nov"
onPay={pay}
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
plan | { name: string; price: Cents; interval: "month" | "year" } | Yes | – |
description | string | No | One line under the title: what they are buying, in words. |
reference | string | No | The order reference, shown beside the title: "#40950". |
countries | CheckoutCountry[] | Yes | – |
defaultCountry | string | No | – |
resolveTax | (country: string) => Promise<TaxRule | null> | Yes | Resolve tax for a country. Asynchronous, because the buyer's tax service usually is — and while it runs, Pay waits. `null` means no tax applies, which is shown as a line, not left out. |
applyCode | (code: string) => Promise<CodeResult> | No | Validate a discount code. Omit to hide the option. |
cardElement | React.ReactNode | No | The processor's card field. This component never renders its own. |
nextChargeOn | string | Yes | When the next full charge happens: "14 Oct". |
defaultEmail | string | No | – |
defaultCompany | string | No | – |
currency | string | No | – |
locale | string | No | – |
title | string | No | – |
onPay | (details: { | No | – |
email | string | Yes | – |
company | string | Yes | – |
country | string | Yes | – |
taxId | string | Yes | – |
code | string | No | – |
total | Cents | Yes | – |
look | Look | No | Layered puts the order summary in the tray and the billing details on the card. Flat is one card. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themeAccessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances