Compute Merchant Settlement Amounts With Fees and GST in Paise

Last updated: November 29, 2026

Quick Overview

Given a list of payments with merchant id, amount in paise and status, compute each merchant's net settlement after deducting a percentage platform fee and 18% GST on that fee. Only captured payments settle, and every value must stay an exact integer number of paise.

Razorpay
Coding & Algorithms
Software Engineer
Razorpay
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of payments with merchant id, amount in paise and status, compute each merchant's net settlement after deducting a percentage platform fee and 18% GST on that fee. Only captured payments settle, and every value must stay an exact integer number of paise.

A warm-up in the style of a Razorpay backend phone screen, where settlements to merchants are a core daily job. The interviewer checks whether you avoid floating point for money, round consistently, and filter by payment status before doing any arithmetic.

What the Interviewer Expects
  • Represent money as integer paise, never floats
  • Express fee as basis points and round half up deterministically
  • Apply GST on the fee, not on the payment amount
  • Skip non-captured payments and aggregate per merchant
  • Explain rounding choice and where per-payment vs per-batch rounding differs
Key Topics to Cover
integer money arithmetic
basis points
rounding
aggregation
settlements
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Should fees be rounded per payment or on the merchant's daily total, and what changes?
  • How would you support different fee rates per payment method (UPI vs credit card)?
  • How do refunds issued today against yesterday's payments affect today's settlement?
  • How would you make this job safe to re-run if it crashes halfway?
Sharpen Your Skills on Codemia

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

Practice DSA Problems
Sample Answer
Requirements

Input: tuples (merchant_id, amount_paise, status), a fee in basis points (200 bps = 2%), GST at 1800 bps. Output: a map of merchant to net paise. Only captured payments count. All values are integ...

High-Level Design

One pass over payments. For each captured payment compute fee = round(amount * bps / 10000) and gst = round(fee * 1800 / 10000) with integer arithmetic (add half the divisor before floor division)...


Submit Your Answer
Markdown supported

Related Questions