Incident · tunyt's second event
Published · 4 min read
I spent a whole night looking for money that was never missing
At tunyt's second event, three people paid and never got their tickets. I fixed that by hand. Then Razorpay showed money our dashboard didn't, and I spent the night in a spreadsheet I didn't know how to use. What caused it, the call that saved the customers, and how we reconcile now.
At tunyt's second event I spent a whole night looking for money that was never missing. By morning I'd accounted for every rupee, and the problem turned out to be hiding inside a fix I'd already made.
The webhook drove everything
When someone pays, Razorpay sends our server a webhook: an HTTP request saying the payment succeeded. We made that the trigger for everything after a payment:
- create the ticket,
- send the QR code,
- increase the number of tickets sold,
- add the amount to the organiser's dashboard.
Most of that I'd still defend. You can't trust a browser to say it paid, because anyone can fake a success screen. The webhook comes from Razorpay's servers to ours, so it's the confirmation you can believe.
The weakness was that it was the only path. One event in, four effects out, and nothing checked afterwards.
The night it broke
Three people bought tickets and never got them. The money left their accounts. On our side: no ticket, no QR code, no email. I traced it back. Razorpay had disabled our webhook, so payments were arriving and our system never heard about them.
People first, then the books
I had two jobs. One was understanding what happened. The other was that three people had paid for an event and had nothing to show at the door, and that one had a deadline.
So I turned the webhook back on and emailed all three their QR tickets by hand. They were getting in, whatever else was true. I'd make that call again. It's also what set up the rest of my night.
Then the money didn't add up
While checking I'd covered everyone, I went through the payments, and Razorpay showed more money than our dashboard did. It looked like three payments had arrived with no tickets behind them at all. Three people without tickets I understood. Three payments with no people was worse.
Line by line
I knew very little about reconciliation then. I didn't know how much data I could pull from Razorpay, or that a short script could compare it with our records. I wasn't good with Excel either.
So I exported everything to CSV and went through it by hand. Payment ID. Order string. Does it exist on our side? Next line. It's slow enough that you start doubting your own spreadsheet.
The answer
By morning I had it. There were no extra payments. They were the same three people.
When the webhook stopped, none of the four steps ran. I'd fixed step 2 by hand because that's the one people see. Steps 3 and 4 never happened: the ticket count didn't go up and the amount never reached the dashboard. The money was all there. My manual fix made the customers whole and left the books exactly as wrong as before.
What a webhook promises
A webhook is a notification. Providers try to deliver it and retry on failure, but the guarantees are looser than they look. It can arrive late, twice or not at all, and it can be switched off on the provider's side without anything in your app noticing.
When one notification triggers four effects and nothing double-checks, you don't get a loud failure. Your records drift away from reality, and nobody finds out until the numbers stop adding up.
How we do it now
We pull payment data from Razorpay, store it in our own database and compare the two with a script. If money arrived and our side doesn't fully reflect it, the script finds it before an organiser or an attendee at the door does. The check runs automatically now, with AI in the loop to flag anything that doesn't match.
If I designed it today I'd also make every post-payment step safe to run twice, keyed by the payment ID. A missed webhook would mean "run it again", and nobody would be fixing it by hand at night.
What I took from that night: a manual fix only repairs what you can see. I completed one step of a four-step transaction, and the other three didn't complain when they were skipped.
By Aditya Dutt Pandey, CTO of tunyt