Fintech · Payments14 weeks · 2025

LedgerLine: Real-Time Payments at Fintech Scale

Rebuilt a fragile payments monolith into idempotent microservices — cutting P95 latency 58% and unlocking same-day settlement.

Backend EngineeringAPI DevelopmentDevOpsNode.jsPostgreSQLRedis
XLinkedIn
-58%
P95 latency

820ms → 340ms

0
Double-charges

idempotency guaranteed

4.2M
Daily transactions

+3.1× headroom

99.99%
Settlement success

same-day rails

01 — Challenge

Where it hurt

LedgerLine processed payouts through a five-year-old monolith where retries created duplicate charges, deploys required Sunday maintenance windows, and a single Postgres primary carried every read. Growth had stalled because the platform could not be trusted.

02 — Approach

What we built

We carved domains along money boundaries — ledger, payouts, reconciliation — each with typed contracts and idempotency keys. Reads moved to replicas with Redis caching, writes flowed through Kafka with exactly-once semantics, and Terraform codified multi-AZ infrastructure with per-PR preview environments.

Outcomes, with receipts

  • Idempotent payout APIs with 24h keyed replay — duplicate charges eliminated
  • P95 latency 820ms → 340ms under 3× peak load (k6 verified)
  • Zero-downtime deploys; lead time from 11 days to under 8 hours
  • Reconciliation pipeline with drift alerts — finance closes in hours, not days

LedgerLine had product-market fit and a platform that punished growth: every traffic spike became an incident, every deploy a negotiation with finance. Fourteen weeks later, settlement was boring — the highest compliment infrastructure can earn.

Cutting along money boundaries

We split the monolith into ledger, payouts, and reconciliation services with OpenAPI contracts generated from types. Each service owns its data; cross-domain reads go through versioned events, never direct table access. The strangler pattern kept the old rails running while traffic shifted slice by slice.

Making retries safe by construction

Payments fail mid-flight — webhooks time out, clients retry, queues redeliver. Idempotency keys on every mutation plus exactly-once Kafka consumers turned retries from a revenue risk into a non-event. Finance got a replay dashboard; engineering got sleep.

“APHYP didn't just rewrite our backend — they gave us a platform finance and engineering both trust. Settlement went from scary to boring.”

Priya Natarajan — CTO, LedgerLine