Skip to main content
A PaymentMeans record represents a payment instrument — a bank account, card, or paper check — linked to a financial transaction as either the debtor or creditor side. It acts as the bridging entity between transactions and the specific financial instrument used, referencing a normalized Account, Card, or Check entity to carry instrument-specific details. Every payment_means row is workspace-scoped and may be associated with a Company or a People record that owns or operates the instrument. The entity is a primary MCP sync target, and its sourceWorkspaceConnector tracks which connector ingested the row.

API operations

Data model

Attributes

Relationships

System-computed

  • payment_means_id is generated via gen_random_uuid() as a PostgreSQL server-side default. It is unique and immutable after insert.
  • created_at is set once at insert time via MikroORM onCreate lifecycle hook. It is never updated.
  • updated_at is set at insert and refreshed on every update via onUpdate lifecycle hook.
  • deleted_at is null on active rows. Setting it to a non-null timestamp soft-deletes the row. The compound index idx_payment_means_workspace_deleted (workspace, deleted_at) enables efficient active-record queries per workspace.
  • payment_means_external_id is the connector deduplication key. The connector sync pipeline uses this to perform idempotent upserts: if a row with the same payment_means_external_id already exists in the workspace scope, the existing row is updated rather than a duplicate created.
  • sourceWorkspaceConnector is set automatically by the MCP sync pipeline when a row is ingested from a connector. It remains NULL for rows created through invoice parsing, manual entry, or other non-connector paths.
  • The name column was introduced in Migration20260102111942 as a rename of the legacy digital_wallet_id column from the original flat-column schema. It now serves as a generic free-text label regardless of instrument type.
  • Exactly one of account, card, or check should be set on a given row — this is a polymorphic instrument pattern. Both company and people may be set simultaneously (e.g. a personal card belonging to a company employee), or only one may be set, or neither.
  • Transactions reference payment_means via debtor_payment_means_pk and creditor_payment_means_pk. A single payment_means row can appear on many transactions over time.

Example

Source: apps/api/src/database/entities/PaymentMeans.ts · domain: financial-graph · tier: Main