sequenceDiagram
autonumber
participant C as Client
participant G as API Gateway
participant O as Order Service
participant P as Payment Gateway
participant Q as Event Log
C->>G: POST /orders (Idempotency-Key)
G->>O: create order
O->>O: persist as PENDING
O->>P: authorise (deadline 3s)
alt authorised
P-->>O: approved + auth id
O->>O: mark CONFIRMED
O->>Q: OrderConfirmed
O-->>G: 201 Created
else declined
P-->>O: declined
O->>O: mark REJECTED
O-->>G: 402 Payment Required
else timeout
P--xO: no response by deadline
O->>O: keep PENDING
O-->>G: 202 Accepted (poll for status)
Note over O,P: reconciliation job settles<br/>PENDING against the provider
end
G-->>C: response
Sequence Diagram
One scenario as an ordered exchange of messages between participants, with time on the vertical axis and the failure paths drawn rather than assumed.