Card payments card
Card payments on invoices for a settings screen: the payment account's status (not connected, onboarding, connected, rejected) with what it means, Set up, Activate after onboarding, Continue onboarding or Manage account, and Disconnect behind a confirmation. By default it runs usePaymentAccount; or pass your own account.
Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. Pages vs components
Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.
Installation
Needs the Dolfin registry token. The CLI copies the source into your app.
bunx --bun shadcn@4.23.0 add @dolfin/ar-payment-account-cardAlso installs: button, popover, base-info-hint, base-states, base-status-badge, base-theme, ui-ar-payment-account-card.
Usage
import { PaymentAccountCard } from "@/components/dolfin/ar/payment-account-card";
// Place it anywhere inside your <DolfinProvider>.
<PaymentAccountCard />Renders inside DolfinProvider (set it up once). By default it loads its own data through the SDK. Supplied-data examples show how to override that behavior.
API reference
| Prop | Type | Description |
|---|---|---|
account | { organisationId?: string; provider?: null | components["schemas"]["PaymentProvider"]; accountId?: null | string; status?: components["schem… | Your payment account (`usePaymentAccount().account`). Passing it (or `loading` or `error`) fetches nothing and shows only the buttons you pass callbacks for. `null` reads as not connected. |
loading | boolean | |
error | Error | |
onRetry | () => void | Shows "Try again" in the error state, and a refresh button beside the status. |
onEnable | () => void | "Set up card payments" when not connected, "I've finished, activate" while onboarding. By default it starts the account and opens onboarding, or activates it; yours replaces that. |
onOpenOnboarding | () => void | "Continue onboarding" while onboarding, "Manage account" once connected. By default it opens the provider. |
onDisconnect | () => void | Shows Disconnect on a started account. By default (no `account`) the SDK's own asks first, then turns card payments off; yours replaces it, confirmation included, and runs at once. |
pendingAction | PaymentAccountAction | The card's button running now. |
enableDisabledReason | string | Disables Set up and Activate and explains why. Yours wins (`""` = enabled); by default `undefined` means the SDK's reason for the user's role. |
title | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the title ("Card payments"). |
children | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | More under the buttons, such as a note on fees. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.paymentAccountbase.infoHint.moreAbout
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.
useMessagesusePaymentAccountusePermissionsFiles
Written to your app by the install command:
components/dolfin/ar/payment-account-card.tsx184 lines