DevLearn
Back to Payments & Banking
payments

Reconciliation Engine

Matching gateway, acquirer, bank, and ledger records

Reconciliation Engine — Overview

Matching gateway, acquirer, bank, and ledger records

Reconciliation engines match transactions across systems: gateway logs, acquirer settlement files, bank statements, and internal ledger. Three-way match detects missing captures, duplicate settlements, FX discrepancies, and timing differences.

@Scheduled(cron = "0 0 6 * * *")
public void dailyReconciliation() {
  List<GatewayTxn> gateway = gatewayRepo.findByDate(yesterday);
  List<AcquirerRecord> acquirer = acquirerFileParser.parse(yesterday);
  List<LedgerEntry> ledger = ledgerRepo.findByDate(yesterday);

  ReconciliationReport report = matcher.threeWayMatch(
      gateway, acquirer, ledger,
      MatchKey.of(rrn, amount, currency)
  );

  report.getUnmatched().forEach(item -> {
    if (item.getType() == UNMATCHED_GATEWAY)
      alertService.send("Missing acquirer record", item);
    kafka.send("reconciliation-exceptions", item);
  });
}
Tip: Run reconciliation before merchant payout — paying out on unreconciled data creates irrecoverable losses.