---
title: "Discussion on \"Building Production Subscriptions with Razorpay: Webhooks, Signatures, and Edge Cases\" | Hashnode"
description: "Discussion on \"Building Production Subscriptions with Razorpay: Webhooks, Signatures, and Edge Cases\". A practical engineering guide to handling RBI e-mandates, flipped HMAC signatures, Fastify raw body buffers, and idempotent webhooks in Node.js."
url: "https://hashnode.com/posts/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz/6ad21ffbec9993070842df3b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Building Production Subscriptions with Razorpay: Webhooks, Signatures, and Edge Cases](https://blog.zyvop.com/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz?utm_source=hashnode&utm_medium=feed)

A practical engineering guide to handling RBI e-mandates, flipped HMAC signatures, Fastify raw body buffers, and idempotent webhooks in Node.js.

Oct 16 · 11 min read · blog.zyvop.com  
Read the article

-   [#architecture](https://hashnode.com/tag/architecture)
-   [#backend](https://hashnode.com/tag/backend)
-   [#fastify](https://hashnode.com/tag/fastify)
-   [#payments](https://hashnode.com/tag/payments)
-   [#razorpay](https://hashnode.com/tag/razorpay)

## Written by

[ZyVOP](https://hashnode.com/@zyvop)

@zyvop · Delhi, India

  
[View profile](https://hashnode.com/@zyvop)

The Developer Publishing Hub

One platform to write, cross-post to Dev.to, Medium, WordPress, Hashnode, and Bluesky, and protect your SEO with canonical links. Zero paywalls and full content ownership.

## Responses 6

Markdown supported · ⌘↵ to post

[Yunus Emre Vurgun](https://hashnode.com/@yunusemrevurgun)

[Oct 18](https://hashnode.com/posts/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz/6ad21ffbec9993070842df3b/comment/6ad481b24732c937f7b2c124)

The flipped signature payload between orders and subscriptions is exactly the kind of thing that eats a day. One addition to the idempotent webhook part: webhooks can still go missing entirely (endpoint down during a deploy, retries used up), so a small scheduled reconciliation job that fetches the status of any subscription not updated in the last day or so catches the ones that silently moved to halted or cancelled. It also gives you an easy health check: if reconciliation keeps finding changes, your webhook path has a problem.

[ZyVOP](https://hashnode.com/@zyvop)

[Oct 18](https://hashnode.com/posts/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz/6ad21ffbec9993070842df3b/comment/6ad481b24732c937f7b2c124#reply-6ad4853e68ae7e17881414a9)

Thank you for reading, we have implemented the same on ZyVOP

[Reza Pratama](https://hashnode.com/@rezapratama)

[Oct 17](https://hashnode.com/posts/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz/6ad21ffbec9993070842df3b/comment/6ad3932b21f12958863b7c11)

the flipped signature order between subscriptions and orders is the kind of thing worth a unit test with a fixture for each payload, since it only fails in production when a real webhook arrives. same for the raw body issue, a test that sends a real signed request through the framework catches it early.

[ZyVOP](https://hashnode.com/@zyvop)

[Oct 17](https://hashnode.com/posts/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz/6ad21ffbec9993070842df3b/comment/6ad3932b21f12958863b7c11#reply-6ad39376b988f2b619296a1a)

Yes we did implemented as per the blog on ZyVOP

[StackShortlist](https://hashnode.com/@veristria)

[Oct 17](https://hashnode.com/posts/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz/6ad21ffbec9993070842df3b/comment/6ad33420c07b9b4a34a54a88)

The flipped signature payload between orders and subscriptions is a nasty one, since both checks look correct in isolation and only one fails in production. Leaning on the 23505 unique violation for idempotent webhook storage is a clean way to handle the client and webhook race without extra locking. Good call on keeping currency in subunits too.

[ZyVOP](https://hashnode.com/@zyvop)

[Oct 17](https://hashnode.com/posts/building-production-subscriptions-with-razorpay-webhooks-signatures-and-edge-cases-odzkz/6ad21ffbec9993070842df3b/comment/6ad33420c07b9b4a34a54a88#reply-6ad335d0781ac5708dbb6dd1)

Thanks and I already implemented in ZyVOP
