PAYMENTS SIGNAL REFERENCE ARCHITECTURE · SYNTHETIC / TRAINING ONLY
Payment lifecycle, state, event, queue, and idempotency architecture
A payment is not one database row that changes mysteriously. It is an ordered history of commands, proven outcomes, deadlines, and external facts.
Reference architecture v1 · reviewed 2026-07-23
Reference architecture—not a scheme mandate. The blueprint assumes one logical payment-state owner and uses one queue and one journal. Real estates may shard by product or region and may use several brokers, stores, and recovery coordinators.
Components
Command intake
Receives a request to do something and assigns it one identity.
- Kind
- service
- Owner
- Payment platform
- Responsibilities
- Authenticate the caller
- Validate the requested command
- Apply idempotency
- Inputs
- Submit, cancel, release, return, retry, or repair command
- Outputs
- Accepted command or reasoned rejection
- Controls
- Caller entitlement
- Expected version
- Idempotency key
- Failure modes
- Stale command
- Repeated command
- Unauthorised action
- Recovery
- Return the prior result or reject the stale action
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Payment state machine
Allows only transitions that make sense for the payment’s proven history.
- Kind
- application
- Owner
- Payment platform
- Responsibilities
- Evaluate transitions
- Issue downstream commands
- Record pending and final states
- Inputs
- Commands and dependency outcomes
- Outputs
- New state, events, timers, and exceptions
- Controls
- Optimistic concurrency
- Final-state protection
- Reason codes
- Failure modes
- Impossible transition
- Two writers
- State ahead of evidence
- Recovery
- Quarantine conflicts
- Rebuild from the journal
- Reconcile external facts
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Immutable event journal
Keeps the ordered facts from which the current payment state can be explained.
- Kind
- data-store
- Owner
- Payment platform
- Responsibilities
- Append facts once
- Preserve order
- Link commands and results
- Inputs
- Outputs
- Event stream and reconstructed history
- Controls
- Sequence
- Integrity
- Retention
- Access control
- Failure modes
- Event gap
- Duplicate event
- Out-of-order event
- Recovery
- Detect sequence breaks
- Replay idempotently
- Repair projections without rewriting facts
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Transactional outbox and queue
Carries commands and events without losing them between the payment record and another system.
- Kind
- service
- Owner
- Payment platform
- Responsibilities
- Publish after durable commit
- Retry delivery
- Preserve ordering where required
- Inputs
- Outputs
- At-least-once delivery with stable message identity
- Controls
- Stable message ID
- Retry backoff
- Dead-letter monitoring
- Failure modes
- Poison message
- Queue backlog
- Duplicate delivery
- Recovery
- Fix or quarantine poison data
- Replay safely
- Scale consumers
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Timer and deadline service
Turns a business deadline into a recorded event instead of an untracked sleep.
- Kind
- control
- Owner
- Payment platform
- Responsibilities
- Schedule cut-offs and timeouts
- Fire once logically
- Cancel obsolete timers
- Inputs
- Deadline and payment identity
- Outputs
- Controls
- Clock source
- Deduplication
- Late-event handling
- Failure modes
- Timer fires twice
- Clock drift
- Timer lost
- Recovery
- Reconcile due timers
- Apply idempotent timeout handling
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Ledger system
Owns the accounting fact independently from the payment engine’s processing state.
- Kind
- ledger
- Owner
- Core banking and finance
- Responsibilities
- Post once
- Return journal evidence
- Reverse through a separate entry
- Inputs
- Outputs
- Posting result and journal reference
- Controls
- Balanced entries
- Posting key
- No destructive edit
- Failure modes
- Unknown response
- Rejected posting
- Duplicate conflict
- Recovery
- Query
- Adopt
- Retry or reverse under authority
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
External network
Owns delivery, acceptance, clearing, or settlement facts outside the bank.
- Kind
- external-network
- Owner
- External network or market infrastructure
- Responsibilities
- Apply network rules
- Return acknowledgement and status
- Preserve duplicate treatment
- Inputs
- Outputs
- Acknowledgement, status, settlement evidence, report
- Controls
- Message identity
- Participant entitlement
- Finality
- Failure modes
- Late status
- Unknown outcome
- Service outage
- Recovery
- Use network enquiry and contingency procedures
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Read model and status API
Presents a useful current view without becoming a second source of truth.
- Kind
- service
- Owner
- Payment platform
- Responsibilities
- Project events
- Explain pending states
- Serve channels and operations
- Inputs
- Outputs
- Current status, history, and next permitted actions
- Controls
- Freshness indicator
- Version
- No unauthorised actions
- Failure modes
- Stale projection
- Missing event
- Misleading final status
- Recovery
- Rebuild from the journal
- Expose freshness and uncertainty
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Exception and reconciliation desk
Resolves cases where internal state and external evidence do not yet tell one consistent story.
- Kind
- operations
- Owner
- Payment operations
- Responsibilities
- Compare facts
- Stop unsafe replay
- Apply controlled recovery
- Close only on evidence
- Inputs
- Payment history, ledger journal, network evidence, timers, alerts
- Outputs
- Reasoned command, escalation, or reconciled closure
- Controls
- Segregation of duties
- Evidence checklist
- State-aware action permissions
- Failure modes
- Premature closure
- Manual duplicate
- Action on stale state
- Recovery
- Refresh facts
- Reopen
- Apply compensating action under authority
- Non-functional requirements
- Traceable processing with stable identifiers
- Capacity and availability matched to the supported payment service
- Auditable state changes and operator actions
Interfaces
Expected-state command
state-command → state-machine
Ask for one transition against a known payment version.
- Contract
- api · synchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Reject stale, duplicate, or unauthorised commands.
Append state event
state-machine → state-journal
Record the accepted fact before publishing downstream work.
- Contract
- event · asynchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Do not expose an uncommitted transition.
Committed work
state-journal → state-outbox
Publish only work associated with a committed state.
- Contract
- event · asynchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Retry delivery with the same event identity.
Posting command
state-outbox → state-ledger
Request one posting using a stable key.
- Contract
- posting · asynchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Duplicate delivery must return the existing posting result.
Network command
state-outbox → state-network
Release one network instruction after its prerequisite state is committed.
- Contract
- message · asynchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Use message identity and network enquiry before replay.
Network result
state-network → state-machine
Advance the payment using external evidence.
- Contract
- event · asynchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Late or duplicate results are correlated and assessed against the current state.
Deadline event
state-timer → state-machine
Turn time expiry into a normal idempotent state input.
- Contract
- control · asynchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- A duplicate timeout must not apply its effect twice.
Projection feed
state-journal → state-projection
Build channel and operator views from authoritative events.
- Contract
- event · asynchronous
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Expose staleness and rebuild without changing the event journal.
Case evidence
state-projection → state-operations
Present current state, uncertainty, and permitted actions.
- Contract
- operator · operator
- Controls
- Authentication
- Authorisation
- Integrity
- Correlation
- Audit
- Failure treatment
- Refresh and reject commands if the payment version changed.