app.payments
TableRow level security on
Payments made to or received from a counterparty. Applications spread a payment over invoices; a payment is never applied beyond its amount.
Primary key: id
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | uuid | No | Primary key, UUID v7. |
| org_id | uuid | No | Owning org, derived from the counterparty on insert. For a person payee it is the paying org, which must engage the person as an individual; never changed.References app.organizations.id |
| counterparty_id | uuid | Yes | Counterparty paid or paying; NULL when the payee is a person engaged as an individual.References app.counterparties.id |
| direction | app.money_direction | No | Payable (we pay) or Receivable (we are paid). |
| amount_minor | bigint | No | Amount in minor units of currency_code. |
| currency_code | character(3) | No | ISO 4217 currency of the payment.References private.currencies.currency_code |
| paid_on | date | No | Date the money moved. |
| reference_identifier | text | Yes | Bank or card reference of the movement. |
| payment_state | app.payment_state | No | Payment state. Changes only through the payment RPCs. |
| deleted_at | timestamp with time zone | Yes | Soft delete time. A row with deleted_at set is ignored by every access helper. |
| created_at | timestamp with time zone | No | When the row was inserted. Set by the database. |
| created_by | uuid | Yes | Person who inserted the row, or null for a platform process. Set by the database.References app.people.id |
| updated_at | timestamp with time zone | No | When the row last changed. Set by the database. |
| updated_by | uuid | Yes | Person who last changed the row, or null for a platform process. Set by the database.References app.people.id |
| payee_person_id | uuid | Yes | Person paid as an individual. Exactly one of counterparty_id and payee_person_id is set.References app.people.id |