Functional contract

Billing and finance

Clinic AR: invoices issued from sales orders, record-only payments, deposits, credit notes, a per–Legal Entity client ledger, tips, and commissions are built. Cash-up, live processors, PDF, and reports remain intended. Invoices are hybrid: the legal header comes from the Location’s Legal Entity; the sale is attributed to the Location. For TaskPaws platform subscriptions (plans, credits, Stripe), see SaaS billing.

Invoices, payments, deposits, credit notes, ledger shipped Cash-up, processors, PDF, reports later 3 Nov 2026
Invoice total = subtotal − order discount + exclusive taxes (+ platform fee and its taxes) Net total = total − amount credited (issued credit notes) Amount due = net total + tip total Balance due = amount due − amount paid Amount paid = payment applications + deposit applications − refunds on them

Invoices

Clinic → Invoices (invoices.*). One invoice per open sales order (1:1); lines and totals are immutable. Do not confuse with Settings → Billing / billing.* / BillingInvoice (SaaS).

Issue (POST /app/checkout/:id/invoice, invoices.manage):

  1. Lock the open order (rejected if not open, already invoiced, or empty); resolve ship-to and notes.
  2. Assign the number; create invoice, lines, and taxes; append the platform fee line when the org charges clients (usage credits are spent here).
  3. Calculate staff commissions.
  4. Release stock reserved for the order and consume inventory (bundle lines consume their components); mark the order invoiced.
  5. Post invoice_issued to the ledger, save tips, apply linked deposit credit.

Statuses: issued → partially_paid → paid, or credited when credit notes cover the whole total. Historical invoices do not change if the Location later moves to another Legal Entity.

Payments

Record-only collection on issued invoices: multi-tender, partial, optional payor shares, per-tender receipts (RCP-), and audit history. No processor webhooks yet.

ConcernLevelBehavior
Merchant account (e.g. Stripe Connect, intended)Legal EntityLocations sharing an entity settle to its bank; a Location with its own entity settles separately
Card terminalLocationHardware and “which desk took the payment” are site-local
Cash / checkLocationCounted in that site’s drawer
Payment applicationLocation + Legal EntityApplied to that entity’s invoices only; never silently pays another entity’s AR

Deposits

A Deposit (DEP-000123) is a prepayment request linked to an appointment, visit, and/or sales order. Requesting posts nothing; paying posts payment_received (client goes into credit). Not SaaS CreditAccount.

StatusMeaningBlocks check-in
pendingNothing paidYes
partially_paidSome paidYes
paidFully paidNo
waivedStaff waived collection (paid part stays credit)No
voidedCancelled; only with nothing paid or appliedNo

Credit notes

Always tied to one invoice (CN-000001 per Legal Entity; drafts show CN-DRAFT-<id>). Draft is editable and touches nothing; issued is immutable (correct with another credit note). Clinic → Credit notes.

On issue: amount_credited rises (so net_total and balance_due = net_total + tip_total − amount_paid drop); ledger credit_note_issued (−total); if now overpaid, newest allocations shrink (payments become open amount, deposits regain available credit); flagged lines restock (batch items to the sold lots, bundles return stocked components); staff commissions are reversed; invoice becomes credited at zero net. Payor shares must still sum to net_total + tip_total.

Example Invoice 100 paid 100, credit note 100 → client balance −100, invoice credited, payment open amount 100. Refund it (balance 0) or use it as client credit later.

Client ledger

One account per client per Legal Entity with a cached balance (negative = in credit). Entries are append-only and post to the bill-to only; who handed the tender is "paid by" metadata. Allocations (payment or deposit to invoice) never post.

EntryAmount
invoice_issued+ invoice total
credit_note_issued− credit note total
payment_received / payment_voided− / + (amount − platform fee surcharge)
refund_issued+ refund amount
tip_added / tip_voided+ / − tip amount

Shown on the client page (balance due / in favor, running entries, unallocated payments, deposits with credit), invoice show, receipts, and deposits. Multi–Legal Entity balances stay separate.

Tips and commissions

Permissions

RoleInvoices / credit notesPayments / deposits
Organization administratorRead, manageRead, manage
Location administratorRead, manageRead, manage
ReceptionistRead, manageRead, manage
VeterinarianReadRead

invoices.read / .manage cover invoices, credit notes, and the client ledger section; payments.read / .manage cover payments, shares, receipts, refunds, and deposits. Plan feature invoices (Business + Elite, wherever checkout is). SaaS billing.* alone cannot issue clinic invoices. Records at another Location or Organization return 404.

Cross-site balances Intended

If a client owes Location C and presents at Location A:

Default for v1: always collect in the originating Location’s context, identical for same-EIN and split-EIN groups.

Daily close and reports Intended

Each Location runs its own cash-up (expected vs counted, card totals, discrepancies). Accounting export (QuickBooks, Xero, or file) groups by Legal Entity, with Location as a line dimension.

Report contextQuestion it answers
OrganizationGroup performance across every site
Legal EntityBooks and tax for one EIN
LocationSite profitability: appointments, sales by room, inventory, drawer

Filters must not leak Locations the User is not granted (Staff access).

Acceptance

Out of scope: processor onboarding (Stripe Connect / Terminal), live payment links, financing, invoice and statement PDF, invoice void and post-issue line edits, tax-engine choice, payment plans, chart of accounts, mobile API. Full contracts: docs/functional/billing-and-finance.md, clinic-invoices.md, clinic-payments.md, clinic-deposits.md, clinic-credit-notes.md, clinic-client-ledger.md.

Related: Appointment to invoice, Clinic tips, Clinic commissions, SaaS billing, Inventory.