Staaarter

Billing Prepaid Credits

A one-time credit bundle purchase card for token- or credit-based products. Bundles are shown as selectable cards with the price per credit called out, so larger bundles can visibly undercut smaller ones. Selecting a bundle updates the price shown on the Buy button. Built as a real radio group so selection works with keyboard and screen readers, not just pointer clicks.

By Staaarter Team
Billing
Updated April 9, 2026
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, button dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/billing-prepaid-credits.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing98.tsx instead.

Usage

The file also exports billing98Demo, 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 { Billing98, billing98Demo } from "@/components/blocks/billing/billing98";

export default function Page() {
  return <Billing98 {...billing98Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Buy credits"Heading shown above the bundle grid.
descriptionstringnoneOptional supporting text under the heading.
currentBalancestringnoneWhen set, shows the user's current credit balance in the top-right corner.
bundlesCreditBundle[]noneBundles rendered as selectable cards, two per row.
defaultBundleIdstringbundles[0].idWhich bundle is selected on first render.
ctaLabelstring"Buy credits"Label on the purchase button, before the selected bundle's price is appended.
validityNotestringnoneOptional fine print next to the Buy button, for example an expiration or validity note.
classNamestringnoneExtra classes for the outer container.

Types

interface CreditBundle {
  id: string;
  credits: number;
  price: string;
  pricePerCredit: string;
  badge?: string;
}

Behavior notes

  • Selected bundle is local state; clicking a card updates the checked bundle and the price shown on the Buy button.
  • Bundle cards are real buttons inside a role=radiogroup, so selection works with arrow-key navigation and screen readers, not just a mouse click.
  • The Buy button is disabled only if no bundle is selected, which can't happen once a defaultBundleId or a non-empty bundles array is supplied.
  • Clicking Buy doesn't call out to anything by itself, it's on the caller to read the selected bundle from their own state and start a checkout flow.
  • pricePerCredit is a plain formatted string per bundle rather than something the component derives from credits and price, so you control the rounding and decimal places.

Frequently asked questions