public.payments
Description
Labels
svc-smarttab
Columns
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| id | uuid | false | public.refunds public.bill_operation_histories public.slips | Payment identifier (UUID). | ||
| bill_id | uuid | false | public.bills | Parent bill ID. | ||
| split_id | integer | true | public.splits | Split ID for split payments. | ||
| payment_provider_method_id | integer | false | public.payment_provider_methods | Payment provider method ID. | ||
| idempotency_key | varchar(100) | false | Idempotency key for duplicate prevention. | |||
| transaction_id | varchar(255) | true | Provider transaction ID. | |||
| amount | numeric(12,2) | false | Payment amount. | |||
| tip_amount | numeric(12,2) | 0.00 | false | Tip amount. | ||
| total_amount | numeric(12,2) | false | Total payment amount (amount + tip). | |||
| currency | varchar(3) | 'JPY'::character varying | false | Currency code (ISO 4217). | ||
| approval_code | varchar(50) | true | Provider approval code. | |||
| card_last_4 | varchar(4) | true | Card last 4 digits. | |||
| card_brand | varchar(20) | true | Card brand (Visa, MC, etc.). | |||
| entry_method | varchar(20) | true | Card entry method (chip, swipe, contactless). | |||
| status | varchar(50) | true | Payment status: PENDING, SUCCESS, FAILED. | |||
| error_code | varchar(50) | true | Error code from provider. | |||
| error_message | text | true | Error message from provider. | |||
| metadata | jsonb | true | Additional payment metadata (JSON). | |||
| processed_at | timestamp with time zone | true | Payment processed timestamp. | |||
| created_at | timestamp with time zone | now() | true | Record creation timestamp. | ||
| updated_at | timestamp with time zone | now() | true | Record last update timestamp. | ||
| merchant_id | integer | false | public.merchants | Parent merchant ID. | ||
| store_id | integer | false | public.stores | Parent store ID. | ||
| cash_received | numeric(12,2) | true | Cash received (for cash payments). | |||
| change_amount | numeric(12,2) | true | Change amount (for cash payments). | |||
| settlement_id | uuid | true | public.settlements | Settlement ID. | ||
| refunded_at | timestamp with time zone | true | Refund timestamp. | |||
| refund_amount | bigint | true | Refunded amount. | |||
| card_document_number | varchar(20) | true | Card slip document number for refund/cancellation. | |||
| card_arn | varchar(100) | true | Acquirer Reference Number from provider. |
Viewpoints
| Name | Definition |
|---|---|
| Order & Billing | Order lifecycle — Orders → Bills → Payments → Settlements |
Constraints
| Name | Type | Definition |
|---|---|---|
| payments_amount_check | CHECK | CHECK ((amount > (0)::numeric)) |
| payments_tip_check | CHECK | CHECK ((tip_amount >= (0)::numeric)) |
| payments_merchant_id_fkey | FOREIGN KEY | FOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE RESTRICT |
| payments_payment_provider_method_id_fkey | FOREIGN KEY | FOREIGN KEY (payment_provider_method_id) REFERENCES payment_provider_methods(id) ON DELETE RESTRICT |
| payments_store_id_fkey | FOREIGN KEY | FOREIGN KEY (store_id) REFERENCES stores(id) ON DELETE RESTRICT |
| payments_bill_id_fkey | FOREIGN KEY | FOREIGN KEY (bill_id) REFERENCES bills(id) ON DELETE RESTRICT |
| payments_split_id_fkey | FOREIGN KEY | FOREIGN KEY (split_id) REFERENCES splits(id) ON DELETE RESTRICT |
| payments_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| payments_settlement_id_fkey | FOREIGN KEY | FOREIGN KEY (settlement_id) REFERENCES settlements(id) ON DELETE SET NULL |
Indexes
| Name | Definition |
|---|---|
| payments_pkey | CREATE UNIQUE INDEX payments_pkey ON public.payments USING btree (id) |
| ix_payments_bill_id | CREATE INDEX ix_payments_bill_id ON public.payments USING btree (bill_id) |
| ix_payments_created_at | CREATE INDEX ix_payments_created_at ON public.payments USING btree (created_at) |
| ix_payments_idempotency_key | CREATE UNIQUE INDEX ix_payments_idempotency_key ON public.payments USING btree (idempotency_key) |
| ix_payments_split_id | CREATE INDEX ix_payments_split_id ON public.payments USING btree (split_id) |
| ix_payments_status | CREATE INDEX ix_payments_status ON public.payments USING btree (status) |
| ix_payments_merchant_id | CREATE INDEX ix_payments_merchant_id ON public.payments USING btree (merchant_id) |
| ix_payments_store_id | CREATE INDEX ix_payments_store_id ON public.payments USING btree (store_id) |
| ix_payments_settlement_id | CREATE INDEX ix_payments_settlement_id ON public.payments USING btree (settlement_id) |
Relations
Generated by tbls