Bill payments
What was paid against a bill, when, how and by whom, and what is outstanding. Read-only; recording or making a payment goes in the actions slot. Its data is payments: pass them and nothing is fetched. A bill you pass alone only saves the bill's read: the payments of bill.id are still fetched.
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/ap-bill-payments-cardAlso installs: table, base-money, base-states, base-theme, ui-ap-bill-payments-card.
Usage
import { BillPaymentsCard } from "@/components/dolfin/ap/bill-payments-card";
// Place it anywhere inside your <DolfinProvider>.
<BillPaymentsCard />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 |
|---|---|---|
billId | string | Fetches the bill's payments (and the bill for its totals, when `bill` is not given). |
bill | { id?: string; organisationId?: string; state?: components["schemas"]["BillState"]; source?: components["schemas"]["BillSource"]; eInvoiceId… | Supporting: the bill for the paid and outstanding totals. It never selects data mode: passed alone, the card still fetches the payments of `bill.id` (but not the bill). Pass `payments` too and nothing is fetched. |
payments | readonly { id?: string; billId?: string; provider?: components["schemas"]["BillPaymentProvider"]; amount?: number | string; currency: string… | The card's data: the payments to list. Passing it (or `loading` / `error`) fetches nothing. Given with `billId`, the payments win. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
peopleNames | Readonly<Record<string, string>> | Display names by user id, for "by <name>" under a payment. Read for you when the card fetches. |
actions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons in the card header, such as recording a payment or paying by bank. Paying is not part of this card; pass your own action here. |
renderPaymentMeta | (payment: BillPaymentRecord) => ReactNode | Extra content under a payment's amount, e.g. an accounting sync badge. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.bill.paymentsbase.statescore.errors
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.
useBilluseBillPaymentsuseBillPeopleuseDolfinLocaleuseMessagesFiles
Written to your app by the install command:
components/dolfin/ap/bill-payments-card.tsx143 lines