Billing Failed Payment Alert
An alert banner for a failed billing charge, with a title, an explanatory message, and a primary retry button next to an optional update-payment-method button. Meant to sit at the top of a billing page or dashboard so a lapsed payment gets fixed before the account loses access.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its alert, button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-failed-payment-alert.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing2.tsx instead.
Usage
The file also exports billing2Demo, 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 { Billing2, billing2Demo } from "@/components/blocks/billing/billing2"; export default function Page() { return <Billing2 {...billing2Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "Payment failed" | Alert heading. |
| message | string | none | Explanation of what failed and what happens next, shown under the title. |
| retryLabel | string | "Retry payment" | Label for the primary retry button. |
| retryHref | string | none | Destination for the retry button. |
| updatePaymentLabel | string | "Update payment method" | Label for the secondary button. |
| updatePaymentHref | string | none | Destination for the update-payment-method button; the button is omitted entirely if this is not passed. |
| className | string | none | Extra classes for the outer alert element. |
Behavior notes
- Built on the Alert primitive with variant="destructive", which already sets role="alert" so screen readers announce it on mount without any extra markup here.
- The update-payment-method button only renders when updatePaymentHref is passed; leave it out for a retry-only alert.
- Both buttons render as next/link elements via the Button component's render prop, so retryHref and updatePaymentHref should be real routes, not onClick handlers.
- There's no dismiss control and no client-side state. The alert stays visible for as long as the parent chooses to render it, which is usually driven by the account's payment status.
- message is a single string, not structured data. Build the specific decline reason or countdown into that string before passing it in.
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 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.
Billing Subscription Summary
A subscription summary card with plan name, price, renewal date, and per-metric usage bars, plus manage and upgrade actions.