Skip to content

public.payments

Description

Labels

svc-smarttab

Columns

NameTypeDefaultNullableChildrenParentsComment
iduuidfalsepublic.refunds public.bill_operation_histories public.slipsPayment identifier (UUID).
bill_iduuidfalsepublic.billsParent bill ID.
split_idintegertruepublic.splitsSplit ID for split payments.
payment_provider_method_idintegerfalsepublic.payment_provider_methodsPayment provider method ID.
idempotency_keyvarchar(100)falseIdempotency key for duplicate prevention.
transaction_idvarchar(255)trueProvider transaction ID.
amountnumeric(12,2)falsePayment amount.
tip_amountnumeric(12,2)0.00falseTip amount.
total_amountnumeric(12,2)falseTotal payment amount (amount + tip).
currencyvarchar(3)'JPY'::character varyingfalseCurrency code (ISO 4217).
approval_codevarchar(50)trueProvider approval code.
card_last_4varchar(4)trueCard last 4 digits.
card_brandvarchar(20)trueCard brand (Visa, MC, etc.).
entry_methodvarchar(20)trueCard entry method (chip, swipe, contactless).
statusvarchar(50)truePayment status: PENDING, SUCCESS, FAILED.
error_codevarchar(50)trueError code from provider.
error_messagetexttrueError message from provider.
metadatajsonbtrueAdditional payment metadata (JSON).
processed_attimestamp with time zonetruePayment processed timestamp.
created_attimestamp with time zonenow()trueRecord creation timestamp.
updated_attimestamp with time zonenow()trueRecord last update timestamp.
merchant_idintegerfalsepublic.merchantsParent merchant ID.
store_idintegerfalsepublic.storesParent store ID.
cash_receivednumeric(12,2)trueCash received (for cash payments).
change_amountnumeric(12,2)trueChange amount (for cash payments).
settlement_iduuidtruepublic.settlementsSettlement ID.
refunded_attimestamp with time zonetrueRefund timestamp.
refund_amountbiginttrueRefunded amount.
card_document_numbervarchar(20)trueCard slip document number for refund/cancellation.
card_arnvarchar(100)trueAcquirer Reference Number from provider.

Viewpoints

NameDefinition
Order & BillingOrder lifecycle — Orders → Bills → Payments → Settlements

Constraints

NameTypeDefinition
payments_amount_checkCHECKCHECK ((amount > (0)::numeric))
payments_tip_checkCHECKCHECK ((tip_amount >= (0)::numeric))
payments_merchant_id_fkeyFOREIGN KEYFOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE RESTRICT
payments_payment_provider_method_id_fkeyFOREIGN KEYFOREIGN KEY (payment_provider_method_id) REFERENCES payment_provider_methods(id) ON DELETE RESTRICT
payments_store_id_fkeyFOREIGN KEYFOREIGN KEY (store_id) REFERENCES stores(id) ON DELETE RESTRICT
payments_bill_id_fkeyFOREIGN KEYFOREIGN KEY (bill_id) REFERENCES bills(id) ON DELETE RESTRICT
payments_split_id_fkeyFOREIGN KEYFOREIGN KEY (split_id) REFERENCES splits(id) ON DELETE RESTRICT
payments_pkeyPRIMARY KEYPRIMARY KEY (id)
payments_settlement_id_fkeyFOREIGN KEYFOREIGN KEY (settlement_id) REFERENCES settlements(id) ON DELETE SET NULL

Indexes

NameDefinition
payments_pkeyCREATE UNIQUE INDEX payments_pkey ON public.payments USING btree (id)
ix_payments_bill_idCREATE INDEX ix_payments_bill_id ON public.payments USING btree (bill_id)
ix_payments_created_atCREATE INDEX ix_payments_created_at ON public.payments USING btree (created_at)
ix_payments_idempotency_keyCREATE UNIQUE INDEX ix_payments_idempotency_key ON public.payments USING btree (idempotency_key)
ix_payments_split_idCREATE INDEX ix_payments_split_id ON public.payments USING btree (split_id)
ix_payments_statusCREATE INDEX ix_payments_status ON public.payments USING btree (status)
ix_payments_merchant_idCREATE INDEX ix_payments_merchant_id ON public.payments USING btree (merchant_id)
ix_payments_store_idCREATE INDEX ix_payments_store_id ON public.payments USING btree (store_id)
ix_payments_settlement_idCREATE INDEX ix_payments_settlement_id ON public.payments USING btree (settlement_id)

Relations


Generated by tbls

MPAC — MP-Solution Advanced Cloud Service