Payment Methods
Cards on file that warn about the renewal they will miss, not just the expiry date.
PROGet Payment Methods and 168 other Pro components with pro lifetime — Get Pro
- Category
- Billing
- Access
- ProPro · unlocked
- Source
- 411 lines · one file
The decision inside it
The default card refuses to be removed
Removing the card that pays for the plan leaves a subscription that will fail in silence. The row refuses and says what to do first; any other card goes with five seconds to undo.
When to use it
Use Payment Methods for saved cards: the default, expiring and expired cards marked, make default by clicking the row, remove, edit and add. Card marks are drawn for the common networks.
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 Payment Methods for this.
Install it: npx shadcn@latest add @liro/payment-methods
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/payment-methods.
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 { PaymentMethods, type SavedCard } from "@/components/ui/payment-methods";
const cards: SavedCard[] = [
{ id: "c1", network: "visa", last4: "4242", expires: "08/27", isDefault: true },
{ id: "c2", network: "mastercard", last4: "5100", expires: "11/26", expiring: true },
];
export function Cards({ makeDefault, add }: { makeDefault: (id: string) => void; add: () => void }) {
return <PaymentMethods cards={cards} onMakeDefault={makeDefault} onAdd={add} />;
}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 | ||
|---|---|---|---|
cards | SavedCard[] | Yes | – |
renewal | { next: string; after?: string } | No | The renewal dates the expiry warning is measured against. |
paysFor | string | No | What the default card pays for, used in the refusal: "Team". |
title | string | No | – |
onMakeDefault | (id: string) => void | No | – |
onRemove | (id: string) => void | No | – |
onEdit | (id: string) => void | No | – |
onAdd | () => void | No | – |
look | Look | No | Layered sets it in a tray, the heading above the card and the status in the strip below. Flat is one card. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themecard-brandstatus-chipAccessibility
- 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