Opening the shared document…
Diagram playground
Write a diagram as text and it renders here as you type. Canvas editing for six of ten notations. Nothing leaves your browser. Syntax reference ·
1
archlab 1.0 sequence
2
title "Payment capture — the money leg"
3
description "Where an order stops being a promise: authorise, capture, and the two ways it does not finish."
4
5
@sequence
6
autonumber
7
box "Our services" tint=#bfdfff
8
api:participant "Order API" @golang [Go]
9
ledger:participant "Ledger" @postgresql [PostgreSQL]
10
box "Third party" tint=#ffe4e1
11
psp:participant "Card Processor" @external [Stripe]
12
risk:participant "Fraud Scoring" @ai-model
13
14
api -- ledger : "Shares the idempotency key"
15
rect tint=#bfdfff
16
api <-> psp : "Exchange idempotency keys" [REST]
17
api ->+ psp : "Authorise the card" [REST]
18
desc "POST /v1/payment_intents\nbody { amount, currency, card_token }\n201 → { intent_id, status: requires_capture }"
19
psp ~> risk : "Score the attempt"
20
psp ..>- api : "requires_capture"
21
critical "Capture within 7 days"
22
api ->+ psp : "Capture the intent" [REST]
23
psp ..>- api : "succeeded"
24
psp ..~> api : "payment_intent.succeeded (webhook)"
25
api -> ledger : "Post the entry" [SQL]
26
option "processor unreachable"
27
psp x> api : "Webhook never arrives"
28
api -> api : "Schedules a retry with backoff"
29
note right api : "The authorisation holds; only the capture is late"
30
option "already captured"
31
api -> ledger : "Reconciles against the existing entry" [SQL]
32
break "card declined"
33
api ..> psp : "Void the authorisation" [REST]
34
api -> ledger : "Posts nothing — there is no money to record" [SQL]
Tab indents · Esc then Tab leaves the editor · syntax reference
Read-only
- Order API to Ledger (solid line with no head): Shares the idempotency key
- Order API to Card Processor (solid line with an arrowhead at both ends): Exchange idempotency keys [REST]
- Order API to Card Processor (solid line with an arrowhead): Authorise the card [REST]
- Card Processor to Fraud Scoring (solid line with an open head): Score the attempt
- Card Processor to Order API (dotted line with an arrowhead): requires_capture
- Order API to Card Processor (solid line with an arrowhead): Capture the intent [REST]
- Card Processor to Order API (dotted line with an arrowhead): succeeded
- Card Processor to Order API (dotted line with an open head): payment_intent.succeeded (webhook)
- Order API to Ledger (solid line with an arrowhead): Post the entry [SQL]
- Card Processor to Order API (solid line with a cross): Webhook never arrives
- Order API to Order API (solid line with an arrowhead, self-message): Schedules a retry with backoff
- Order API to Ledger (solid line with an arrowhead): Reconciles against the existing entry [SQL]
- Order API to Card Processor (dotted line with an arrowhead): Void the authorisation [REST]
- Order API to Ledger (solid line with an arrowhead): Posts nothing — there is no money to record [SQL]