📖 Story
Razorpay · Merchant Settlement Fees
Tuesday morning at Razorpay's Merchant Finance team. razorpay_merchant_txns logs every transaction attempt for a merchant, along with gateway_fee (what Razorpay charged for processing it) and refund_amount (money sent back to the customer, if any). Failed transactions never actually got charged a fee — but a legacy import logged gateway_fee = -1 for every one of them instead of leaving it NULL, a placeholder someone chose years ago. refund_amount, on the other hand, is a genuine NULL whenever a transaction was never refunded — nobody invented a placeholder for that column. The team wants each merchant's real average fee on transactions that actually incurred one, plus their total refunded amount, without the -1 placeholder being mistaken for an actual fee.