The mistake
After Razorpay Checkout, the browser posts razorpay_payment_id, razorpay_order_id and razorpay_signature to your server. The mistake is marking the order paid without checking the signature.
Why it is dangerous
Everything in that request comes from the client. If the server does not check that razorpay_signature equals HMAC-SHA256(order_id + "|" + payment_id, key_secret), anyone can post a made-up or someone else's payment id (or a cheap payment against an expensive order) and get the product.
How to fix it
Verify the signature against the order id you created and stored, then trust the amount from your own order record (or fetch the payment from Razorpay), never from the client:
// Node
const { validatePaymentVerification } = require("razorpay/dist/utils/razorpay-utils");
const ok = validatePaymentVerification(
{ order_id: order.razorpayOrderId, payment_id: razorpay_payment_id },
razorpay_signature, process.env.RAZORPAY_KEY_SECRET);
if (!ok) return res.status(400).json({ error: "invalid signature" });
# Python (raises SignatureVerificationError)
client.utility.verify_payment_signature({
"razorpay_order_id": order.razorpay_order_id,
"razorpay_payment_id": payment_id,
"razorpay_signature": signature})
What this checker looks for
This page runs webhook-check, which reads
route handlers in Next.js, Express, Fastify, Hono, FastAPI, Flask and Django. The rules most relevant to this page:
| Rule | What it finds |
|---|---|
WHK006 | Razorpay payment trusted without verifying razorpay_signature |
WHK003 | Signature compared with == instead of a constant-time comparison |
WHK004 | Hard-coded webhook signing secret |
WHK005 | Signature verification failure is ignored |
Every finding has a rule id, a severity, file:line, the offending line (secrets masked),
why it matters and how to fix it. Run webhook-check rules for the full list.