Skip to content
arch-lab

Payment capture — the money leg

Where an order stops being a promise: authorise, capture, and the two ways it does not finish.

Open in the playground

Order API[Go]−Hide the 1 service only Order API usesLedger[PostgreSQL]Card Processor[Stripe]−Hide the 1 service only Card Processor usesFraud Scoringrectcritical[Capture within 7 days][processor unreachable][already captured]break[card declined]The authorisation holds; only the captureis late1. Shares the idempotency key2. Exchange idempotency keys [REST]3. Authorise the card [REST]4. Score the attempt5. requires_capture6. Capture the intent [REST]7. succeeded8. payment_intent.succeeded (webhook)9. Post the entry [SQL]10. Webhook never arrives11. Schedules a retry with backoff12. Reconciles against the existing entry [SQL]13. Void the authorisation [REST]14. Posts nothing — there is no money to record [SQL]
  1. Order API to Ledger (solid line with no head): Shares the idempotency key
  2. Order API to Card Processor (solid line with an arrowhead at both ends): Exchange idempotency keys [REST]
  3. Order API to Card Processor (solid line with an arrowhead): Authorise the card [REST]
  4. Card Processor to Fraud Scoring (solid line with an open head): Score the attempt
  5. Card Processor to Order API (dotted line with an arrowhead): requires_capture
  6. Order API to Card Processor (solid line with an arrowhead): Capture the intent [REST]
  7. Card Processor to Order API (dotted line with an arrowhead): succeeded
  8. Card Processor to Order API (dotted line with an open head): payment_intent.succeeded (webhook)
  9. Order API to Ledger (solid line with an arrowhead): Post the entry [SQL]
  10. Card Processor to Order API (solid line with a cross): Webhook never arrives
  11. Order API to Order API (solid line with an arrowhead, self-message): Schedules a retry with backoff
  12. Order API to Ledger (solid line with an arrowhead): Reconciles against the existing entry [SQL]
  13. Order API to Card Processor (dotted line with an arrowhead): Void the authorisation [REST]
  14. Order API to Ledger (solid line with an arrowhead): Posts nothing — there is no money to record [SQL]