Payment Lifecycle¶
Models the lifecycle of a Payment from initial authorisation request through capture, settlement, and potential reversal. Covers all payment instruments: card, digital wallet, BNPL, gift card, and mixed-tender.
Object: payment ·
States: 7 ·
Transitions: 7
State Diagram¶
flowchart LR
%% ── classDef palette ─────────────────────────────────────
classDef stInit fill:#0d9488,stroke:#0f766e,color:#fff,font-weight:bold
classDef stNorm fill:#3b82f6,stroke:#2563eb,color:#fff
classDef stOk fill:#16a34a,stroke:#15803d,color:#fff,font-weight:bold
classDef stFail fill:#dc2626,stroke:#b91c1c,color:#fff,font-weight:bold
classDef stHold fill:#d97706,stroke:#b45309,color:#fff
%% ── nodes ───────────────────────────────────────────────
pending(["Pending"])
authorised["Authorised"]
captured["Captured"]
partially_refunded["Partially Refunded"]
fully_refunded[["Fully Refunded"]]
voided[["Voided"]]
failed[["Failed"]]
%% ── transitions ─────────────────────────────────
pending -->|"payment-authorized"| authorised
pending -->|"payment-captured"| failed
authorised -->|"payment-captured"| captured
authorised -->|"payment-refunded"| voided
captured -->|"payment-refunded"| partially_refunded
captured -->|"payment-refunded"| fully_refunded
partially_refunded -->|"payment-refunded"| fully_refunded
%% ── class assignments ───────────────────────────
class pending stInit
class authorised,captured,partially_refunded stNorm
class fully_refunded stOk
class voided,failed stFail
States¶
| State | Label | Description | Initial | Terminal |
|---|---|---|---|---|
pending |
Pending | Payment request initiated. Awaiting authorisation from payment provider. | ✓ | |
authorised |
Authorised | Payment provider confirmed funds are available and reserved. | ||
captured |
Captured | Funds transferred to retailer. Order commercially fulfilled. | ||
partially-refunded |
Partially Refunded | A portion of captured funds returned to customer. | ||
fully-refunded |
Fully Refunded | All captured funds returned. Payment closed. | ✓ | |
voided |
Voided | Authorisation cancelled before capture. Funds released to customer. | ✓ | |
failed |
Failed | Authorisation or capture rejected by payment provider. | ✓ |
Transitions¶
| From | To | Trigger | Guards |
|---|---|---|---|
pending |
authorised |
payment-authorized |
Payment provider response is approval; Amount does not exceed card limit or wallet balance |
pending |
failed |
payment-captured |
Payment provider declines authorisation |
authorised |
captured |
payment-captured |
Order confirmed; Capture window not expired (typically ≤7 days from auth) |
authorised |
voided |
payment-refunded |
Order cancelled before capture |
captured |
partially-refunded |
payment-refunded |
Refund amount less than captured amount; Return approved |
captured |
fully-refunded |
payment-refunded |
Refund amount equals captured amount |
partially-refunded |
fully-refunded |
payment-refunded |
Remaining balance refunded |