OpenPSP — Payment Orchestrator
Sole author · designing for transactional correctness end-to-end
- Hexagonal architecture with a framework-free domain module and an explicit payment state machine that rejects illegal transitions outright.
- Idempotent payment API — Idempotency-Key plus request hash; a reused key with a different body returns 409. Optimistic locking verified by a concurrent-thread test.
- PSP adapters behind an anti-corruption layer with retry (exponential backoff + jitter, no retry on 4xx), circuit breaker, and timeouts.
- HMAC-verified callbacks with Redis replay protection, and a scheduled reconciler that resolves payments stuck in PENDING.
- Transactional outbox to Kafka — idempotent producer, acks=all, payment_id partition key for per-payment ordering.
- Double-entry ledger — append-only journal, balanced-entry invariant, minor-unit amounts, consumer idempotent under redelivery.