dolfindevelopers

Card payments card

ComponentReceivablesSDK + UI

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

Choose your integration

Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.

Loading preview…

Installation

Needs the Dolfin registry token. The CLI copies the source into your app.

Terminal
bunx --bun shadcn@4.23.0 add @dolfin/ar-payment-account-card

Also installs: button, popover, base-info-hint, base-states, base-status-badge, base-theme, ui-ar-payment-account-card.

Usage

screen.tsx
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

PropTypeDescription
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.
loadingboolean
errorError
onRetry() => voidShows "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() => voidShows 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.
pendingActionPaymentAccountActionThe card's button running now.
enableDisabledReasonstringDisables Set up and Activate and explains why. Yours wins (`""` = enabled); by default `undefined` means the SDK's reason for the user's role.
titlestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the title ("Card payments").
childrenstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…More under the buttons, such as a note on fees.
classNamestring

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.

useMessagesusePaymentAccountusePermissions

Files

Written to your app by the install command:

  • components/dolfin/ar/payment-account-card.tsx 184 lines