Kkarthik.dev
All posts

25 November 2026

Most payment bugs don't happen when the payment succeeds.

They happen in the webhook.

Here's the checklist I use, after building LocalPay, an open-source Razorpay emulator:

  1. Verify the signature on the raw body, before parsing JSON
  2. Assume every webhook arrives twice. Store the event id
  3. Don't trust the order. order.paid can arrive before payment.captured
  4. Make your own API calls idempotent. A timeout doesn't mean it failed
  5. Reply fast, do slow work in a background job. Slow replies cause retries
  6. Test the ugly cases: UPI timeout, bank down, late authorisation

Most teams only test #1 and the happy path.

Then a customer gets charged once and emailed three times.

Which of these has bitten you in production?

#Payments #Backend #Fintech

Discuss this on LinkedIn