PR: #491: feat(settings): wire billing credits checkout [Story-1946] by @ayush-pramaan
View PR →
Story-1946

Settings billing now shows live AI credits and opens checkout

Settings → Billing & usage → AI credits is no longer a sample-data preview. The page reads the live firm credits payload through the generated Kubb hooks, shows balance and cycle usage, lists per-lawyer usage rows from the backend response, and lets a settings-write admin create a Stripe Checkout top-up order.

What changed

Live balance

CreditsPage now calls useAppGetFirmCredits(). Loading, load failure, zero balance, and empty per-lawyer usage states are localized and render without falling back to sample data.

Per-lawyer usage

The usage panel now renders the real byLawyer rows. The current DTO exposes userId and creditsUsed, so the UI shows exactly those values instead of inventing lawyer names.

Top-up checkout

The disabled top-up card is live. It accepts a whole-credit amount, calls useAppCreateCreditTopup() with successUrl and cancelUrl, then redirects the browser to the returned checkoutUrl.

Stripe return

On ?topup=success or ?topup=cancel, the page refetches credits, cleans the query string, and shows a short localized status message.

Removed preview scaffolding

Where it lives

Verify

pnpm test src/components/settings/billing/credits-page.test.tsx
pnpm lint
pnpm typecheck
pnpm build
git diff --check
git status --short

# Hard rule: pnpm codegen was NOT run.

Files changed

8 file(s), +512 / -210 lines

Path Role + -
messages/en.jsonConfig+16-3
messages/hi.jsonConfig+16-3
src/components/agents/chat-credit-indicator.tsxComponent+7-7
src/components/settings/billing/AGENTS.mdComponent+0-54
src/components/settings/billing/credits-page.test.tsxComponent+184-0
src/components/settings/billing/credits-page.tsxComponent+288-79
src/components/settings/billing/fixtures.tsComponent+0-63
src/lib/surface-registry/page-card/catalog.tsLibrary+1-1