Reconcile Internal Payments Against a Bank Settlement File by UTR

Last updated: November 29, 2026

Quick Overview

Given internal payment records and a bank settlement file, both keyed by UTR (the bank's unique transaction reference), classify every record as matched, amount mismatch, missing in bank, missing internally, or duplicate. Support an optional tolerance in paise.

Razorpay
Data Manipulation (SQL/Python)
Data Engineer
Razorpay
November 29, 2026
Data Engineer
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given internal payment records and a bank settlement file, both keyed by UTR (the bank's unique transaction reference), classify every record as matched, amount mismatch, missing in bank, missing internally, or duplicate. Support an optional tolerance in paise.

Razorpay reconciles millions of transactions a day against files from acquiring banks and NPCI, and unreconciled items block merchant settlements. The interviewer wants a clean one-pass join, careful handling of duplicates on both sides, and awareness of the messy realities of bank files.

What the Interviewer Expects
  • Index one side by UTR for O(n + m) matching
  • Detect duplicates on both sides instead of silently overwriting
  • Separate amount mismatches from missing records
  • Make tolerance explicit and default to exact match
  • Describe how the same logic is written as a SQL full outer join
Key Topics to Cover
reconciliation
hash join
full outer join
data quality
settlements
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • Bank files sometimes truncate or pad UTRs. How would you normalise them?
  • How would you write this as SQL over two tables with hundreds of millions of rows?
  • Some bank rows arrive one or two days late. How do you avoid raising false 'missing in bank' alerts?
  • How would you reconcile when one bank credit covers many payments (batched settlement)?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Internal rows: {id, utr, amount} in paise. Bank rows: {utr, amount}. UTR is meant to be unique on each side, but both sides can contain duplicates (retried webhooks, re-sent bank files). Amounts a...

Approach

Build by_utr from internal rows, recording any repeated UTR as a duplicate. Scan bank rows once; a repeat bank UTR is a duplicate, an unknown UTR is missing internally, a known UTR with a different ...


Submit Your Answer
Markdown supported

Related Questions