Money Moved Nothing Written

Your service calls the processor to capture $60 and then inserts the ledger entry. The process is killed between the two steps, so the money moved and the ledger shows nothing. What design prevents this class of failure?

A

Insert the ledger entry first and call the processor afterwards, so that no captured payment can ever end up missing from the books

B

Commit an intent row and an outbox record in one local transaction, then have a worker call the processor with an idempotency key and record the result

C

Open the database transaction, issue the processor call inside it, and commit only after the call returns so both succeed or neither does

D

Coordinate your database and the processor with a two-phase commit so that the capture and the ledger insert are prepared first and then committed under one atomic decision