All articles
Akhter Hussain
October 21, 2026
1 min read
Handling Razorpay webhooks the right way
Akhter Hussain
October 21, 2026
1 min read
#Payments
#Laravel
Payment bugs are the most expensive bugs. Here is the checklist I follow whenever I integrate Razorpay (or Stripe, or PayPal).
- Verify the signature of every webhook before reading the payload.
- Make handlers idempotent — the same event can arrive more than once.
- Treat the webhook as the source of truth, not the redirect back from checkout.
- Log everything with the payment and order IDs.
$expected = hash_hmac('sha256', $request->getContent(), config('services.razorpay.webhook_secret'));
abort_unless(hash_equals($expected, $request->header('X-Razorpay-Signature')), 403);
Enjoyed this article?
Let's talk about your project or team.