Interview Prep Guide

Razorpay Interview Questions and Answers for Software Engineers

Master Razorpay interview preparation with transactional safety questions, secure API design, payment idempotency, and fault-tolerant system architectures.

Database ACID & Transaction Safety

  1. What is database transaction isolation, and why is it critical for handling payment settlements and user wallet balances?

    Transaction Isolation (part of ACID) defines how changes made by one operation become visible to others. It is critical to prevent anomalies like Double Spending or Dirty Reads when updating wallet balances simultaneously.

Idempotency & API Design in Payments

  1. How do you design a secure, idempotent API endpoint for payment processing?

    Require clients to send a unique Idempotency Key in the header. Store this key in a distributed lock database (like Redis) with a transaction state. If the key exists, return the cached transaction response immediately without re-processing.

Fault-Tolerant Settlement Systems

  1. How would you design a fault-tolerant payment reconciliation system that processes millions of transactions daily across multiple bank gateways?

    Use an asynchronous event-driven architecture with transaction ledgers, distributed transactional outbox patterns, message queues (Kafka), and automated background reconciliation cron jobs.

Handling Payment Downtimes & Incidents

  1. During a major online sale, a primary partner bank gateway goes down, causing payment success rates to drop by 40%. How do you mitigate this incident in real time?

    Implement an automated Circuit Breaker pattern with dynamic smart routing. Automatically detect the gateway failure, trip the circuit to halt traffic to that bank, and route new transaction requests to operational backup gateways immediately.

Razorpay Coding Round

  1. Implement a highly secure, concurrent ledger or wallet transaction processor supporting transfers

    A correct implementation requires atomic, thread-safe balance updates. To prevent deadlocks when transferring funds between two wallets simultaneously (e.g., User A transferring to B, and B to A), always lock the wallet accounts in a deterministic order (e.g., lock the account with the smaller ID first). Ensure all operations execute inside a transaction block, and handle potential transaction failures with safe retries.