The TransactionStatus enum represents the lifecycle states of a transaction within the system. These statuses reflect different phases and outcomes, including both transitional and terminal states.
Enum Values
| Status | Description | Terminal/Final Status for transaction |
|---|---|---|
CREATED |
The transaction has been created but not yet processed. | No |
PENDING |
The transaction is awaiting further action (e.g., authorization, 3DS, etc). | No |
APPROVED |
The transaction has been successfully authorized or completed. | Yes |
DECLINED |
The transaction was rejected by the payment provider or bank. | Yes |
CANCELED |
The transaction was canceled either by the user or system. | Yes |
INVALID |
The transaction is marked as invalid due to inconsistencies or errors. | Yes |
SESSION_EXPIRED |
The transaction session expired before it could complete. | Yes |
Transaction lifecycle
From created to final
A transaction can still change while it is CREATED or PENDING. The other five statuses are final.
stateDiagram-v2
[*] --> CREATED
CREATED --> PENDING : submitted
CREATED --> CANCELED : user cancel
CREATED --> INVALID : validation failure
PENDING --> APPROVED : authorized
PENDING --> DECLINED : rejected
PENDING --> SESSION_EXPIRED : timeout
PENDING --> CANCELED : cancel
APPROVED --> [*]
DECLINED --> [*]
SESSION_EXPIRED --> [*]
CANCELED --> [*]
INVALID --> [*]
Notes
- Terminal Statuses: Once a transaction reaches a terminal status, it is considered finalized and immutable.
- Non-Terminal Statuses: Allow additional actions or progression through the transaction lifecycle.