Billing Payment Method Expiry
A warning list that surfaces saved cards nearing or past their expiration date before they cause a failed charge. Each row shows the card, its expiry, and a color-coded urgency level, amber for expiring soon and red for already expired, with a direct link to update it. Built for account settings and billing dashboards as an early line of defense against involuntary churn.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-payment-method-expiry.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing87.tsx instead.
Usage
The file also exports billing87Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Billing87, billing87Demo } from "@/components/blocks/billing/billing87"; export default function Page() { return <Billing87 {...billing87Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Payment methods expiring soon" | Heading above the list. |
| description | string | none | Optional supporting text under the heading. |
| cards | ExpiringPaymentMethod[] | none | Cards rendered as-is, in the order given. |
| updateLabel | string | "Update card" | Label on each row's action button. |
| className | string | none | Extra classes for the outer container. |
Types
export type PaymentMethodUrgency = "expiring" | "expired"; interface ExpiringPaymentMethod { id: string; brand: string; last4: string; expMonth: number; expYear: number; urgency: PaymentMethodUrgency; updateHref: string; }
Behavior notes
- Rows are rendered in the order passed in the cards array; there's no built-in sorting by expiry date.
- The expMonth/expYear pair is only used for display, formatted as MM/YY. Whether a card counts as "expiring" or "expired" is decided by the urgency field you pass in, not computed from today's date.
- Urgency drives both the border/background tint and the icon: expiring cards use an amber CreditCard icon, expired cards use a red AlertTriangle icon.
- Each row's Update card action is a next/link rendered through the Button component, so it works with a direct settings URL out of the box.
- There's no dismiss or snooze action; once a card is passed in, its row stays until you remove it from the cards array yourself.
Frequently asked questions
More Billing Blocks
View all →Billing Invoice List
Invoice history table with status badges, formatted amounts, and a per-row download link, built with shadcn/ui and Tailwind CSS.
Billing Failed Payment Alert
High-contrast failed-payment alert with a message, a retry button, and an optional update-payment-method button, built with shadcn/ui and Tailwind CSS.
Billing Credit Balance
Compact credit balance card with a large total, an optional purchased-versus-promotional breakdown, a low-balance notice, and a top-up button.
Billing Payment Methods
A saved payment method list for React and Next.js with brand icons, a default badge, near-expiry warnings, and remove/set-default actions per row.
Billing Add Card
A card entry form for React and Next.js with auto-formatted fields, internal brand detection, and per-field validation feedback built with shadcn/ui and Tailwind CSS.
Billing Coupon Code
An inline promo code input for React and Next.js with a simulated loading state, an applied summary showing the discount amount, and an invalid-code message.