Description:
The payments table tracks all payment transactions, including amounts, lifecycle states, and timing for retries or follow-up attempts. It’s linked to users and branches, and supports scheduling logic like deferred charges or retry. Use for reconciliation and payment success rates. Not the source of trip revenue.
🔑 Primary Key
id
| Field Name | Data Type | Description |
|---|---|---|
id |
NUMBER | Unique identifier for the payment record. |
amount |
NUMBER | Amount of the payment in the system’s default currency. |
state |
NUMBER | Numerical code representing the current state of the payment (0 => OPEN: open until a certain date; used to collect multiple invoices into 1 payment. 1 => CLOSED: not taking more invoices. 2 => IN_PAYMENT: payment method doesn’t allow instant success. 3 => AWAITING_RETRY: failed before, needs more tries. 4 => PAID: successfully paid. 5 => FAILED: failed too many times. 6 => DISPUTED: user disputed the payment. 7 => COLLECTIONS: handed over to collections. 8 => PUSH_WAITING_FOR_USER: waiting for user interaction. 9 => PUSH_CANCELLED_BY_USER: cancelled by the user. 10 => PUSH_BANK_REFUSED: refused by bank, no retries. 11 => NOTIFIED. 12 => DISPUTE_LOST). |
state_name |
TEXT | String label for state. |
open_until |
TIMESTAMP_TZ | Deadline for the payment to remain open/valid. |
retry_wait_until |
TIMESTAMP_TZ | Time until the system attempts another retry if previous payment failed. |
first_charge_after |
TIMESTAMP_TZ | Optional delay: when the first charge should be attempted after creation. |
branch_id |
NUMBER | Foreign key referencing the associated branch or operational unit. |
guser_id |
NUMBER | Foreign key referencing the user (global user ID) related to the payment. |
created_at |
TIMESTAMP_TZ | Timestamp when the payment record was created. |
updated_at |
TIMESTAMP_TZ | Last time the payment record was updated. |
_snowflake_inserted_at |
TIMESTAMP_NTZ | System timestamp when the record was inserted into Snowflake. |
_snowflake_updated_at |
TIMESTAMP_NTZ | System timestamp when the record was last updated in Snowflake. |
_snowflake_deleted |
BOOLEAN | True if the record was deleted in the source. |