Database Schema
Payment Base ships three Doctrine migrations under
migration/data/ (Version20251031140000.php,
Version20251031140100.php, Version20251031140200.php) that create
six tables. The contract table is the heart of the model — it tracks the
full payment lifecycle from intent to fulfillment.
All tables use the oe_payments_ prefix to avoid collisions with shop
core tables and to make ownership obvious in production schemas.
Quick overview
Table |
Purpose |
|---|---|
|
Smart-Contract aggregate: state, conditions, capture / refund totals. |
|
Provider-agnostic ledger of authorizations, captures, refunds, voids. |
|
Provider-side customer identifiers and saved payment methods. |
|
Cached results for idempotent operations (createPayment, capture, …). |
|
Provider checkout sessions tied to user / basket. |
|
Append-only log of every webhook received. |
oe_payments_contract
Primary key: OXID. Engine InnoDB, charset latin1,
collation latin1_general_ci.
Column |
Type |
Description |
|---|---|---|
|
CHAR(32) |
Contract ID (UUID). |
|
INT |
Shop ID (multi-shop support). |
|
CHAR(32) |
FK to |
|
CHAR(32) NULL |
FK to |
|
VARCHAR(32) |
|
|
VARCHAR(255) NULL |
Free-text reason if state is |
|
TEXT |
Immutable basket snapshot (JSON: items, discounts, totals). |
|
TEXT NULL |
Terms & conditions the customer agreed to (JSON). |
|
TEXT NULL |
Additional metadata (JSON: IP, user agent, session ID). |
|
TEXT |
Conditions with status (JSON: |
|
VARCHAR(32) NULL |
PSP: |
|
VARCHAR(128) NULL |
Provider contract ID (PaymentIntent ID, Order ID, ChargePermission ID). |
|
TEXT NULL |
Provider-specific data (JSON). |
|
DATETIME |
Contract creation timestamp. |
|
DATETIME |
Last update timestamp. |
|
DATETIME NULL |
When the order was created (contract committed). |
|
DATETIME NULL |
When payment was captured (contract fulfilled). |
|
DECIMAL(10,2) NULL |
Captured payment amount. |
|
DECIMAL(10,2) NULL |
Total refunded amount (accumulates across partial refunds). |
|
DATETIME NULL |
When payment was captured. |
|
DATETIME NULL |
When the last refund was processed. |
|
DATETIME NULL |
Contract expiration timestamp (default: +24 h after creation). |
Indexes: IDX_STATE, IDX_USER, IDX_ORDER,
IDX_PROVIDER_ORDER, IDX_CREATED, IDX_EXPIRES,
IDX_STATE_EXPIRES.
The migration deliberately drops any existing FK_CONTRACT_ORDER foreign
key on first run — the application maintains referential integrity to
oxorder itself so test fixtures can TRUNCATE freely.
oe_payments_transaction
Primary key: OXID. Engine InnoDB, charset latin1,
collation latin1_general_ci.
Column |
Type |
Description |
|---|---|---|
|
CHAR(32) |
Transaction ID. |
|
INT |
Shop ID. |
|
CHAR(32) |
FK to |
|
CHAR(32) NULL |
FK to |
|
VARCHAR(32) |
|
|
VARCHAR(128) NULL |
Provider order / payment ID. |
|
VARCHAR(128) NULL |
Provider transaction ID. |
|
VARCHAR(32) |
|
|
VARCHAR(32) |
|
|
DECIMAL(10,2) |
Transaction amount. |
|
VARCHAR(3) |
Currency code (ISO 4217). |
|
VARCHAR(64) NULL |
Payment method ID. |
|
VARCHAR(32) NULL |
Payment method type ( |
|
CHAR(32) NULL |
FK to parent transaction (for refunds / voids). |
|
DATETIME |
Transaction creation timestamp. |
|
DATETIME |
Last update timestamp. |
Indexes: IDX_ORDER, IDX_CONTRACT, IDX_PROVIDER_ORDER,
IDX_TRANSACTION_ID, IDX_TYPE_STATUS, IDX_PARENT.
Foreign keys: FK_OE_TX_CONTRACT (OXCONTRACTID → contract,
ON DELETE SET NULL); FK_OE_TX_PARENT (self-referential for the
refund / void chain).
oe_payments_customer
1:1 mapping between OXID users and their PSP-side customer record.
Column |
Type |
Description |
|---|---|---|
|
CHAR(32) |
Row ID. |
|
CHAR(32) |
FK to |
|
VARCHAR(128) NULL |
Provider customer ID. |
|
VARCHAR(64) NULL |
Default saved payment method ID. |
|
TEXT NULL |
JSON array of saved payment methods. |
|
BOOLEAN |
Whether the customer has an active billing agreement. |
|
DATETIME NULL |
Last successful payment timestamp. |
|
DATETIME |
Standard timestamps. |
oe_payments_idempotency
Stores the result of idempotent operations so retried requests return the cached outcome instead of re-executing the side effect.
The table cleans itself: every insert (save, claim, a new rate-limit window) deletes up to 500 expired rows. No cron job is needed, and an old backlog is worked off 500 rows at a time.
Column |
Type |
Description |
|---|---|---|
|
CHAR(32) |
Row ID. |
|
VARCHAR(128) |
Idempotency key (unique, |
|
CHAR(32) |
Order ID the operation applied to. |
|
VARCHAR(32) |
|
|
TEXT NULL |
Cached result (JSON). |
|
VARCHAR(32) NULL |
|
|
DATETIME |
Created timestamp and TTL. |
Indexes: UK_KEY, IDX_EXPIRES, IDX_ORDER_OPERATION.
oe_payments_sessions
Tracks provider checkout sessions so an interrupted flow can be resumed.
Column |
Type |
Description |
|---|---|---|
|
CHAR(32) |
Row ID. |
|
VARCHAR(32) |
PSP. |
|
VARCHAR(128) |
Provider session ID. |
|
CHAR(32) NULL |
FK to |
|
CHAR(32) NULL |
Basket reference. |
|
TEXT NULL |
Session payload (JSON). |
|
DATETIME |
Created timestamp and TTL. |
Indexes: IDX_SESSION, IDX_USER, IDX_EXPIRES.
oe_payments_webhooklogs
Append-only log of every webhook received. Deduplicated by provider event ID for idempotent replays.
Column |
Type |
Description |
|---|---|---|
|
CHAR(32) |
Log entry ID. |
|
VARCHAR(128) |
Provider webhook event ID (unique, |
|
VARCHAR(128) NULL |
Event type ( |
|
VARCHAR(32) NULL |
PSP. |
|
CHAR(32) NULL |
FK to |
|
VARCHAR(32) |
|
|
DATETIME |
When the webhook arrived. |
|
TEXT NULL |
Error message if processing failed. |
|
TEXT NULL |
Raw webhook payload (JSON). |
|
DATETIME NULL |
When the webhook was processed. |
Indexes: UK_EVENT_ID, IDX_CONTRACT, IDX_STATUS,
IDX_RECEIVED_AT.