razorpay / razorpay/razorpay-node

[Feature]: Missing Invoice Payment Signature Verification in Docs/SDK

Open
#450 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
243
Forks
128
PR merge metrics
No merged PRs in 30d

Description

The current Razorpay Node.js SDK and documentation only cover order-based payment verification. However, many of us are using the Invoice API to create invoices and collect payments (especially for tax/compliance reasons and downloadable PDFs).

After payment, Razorpay returns these fields:

{
  razorpay_payment_id: "pay_XXXX",
  razorpay_invoice_id: "inv_XXXX",
  razorpay_invoice_status: "paid",
  razorpay_invoice_receipt: "receipt_XXXX",
  razorpay_signature: "generated_signature"
}
Suggested Solution

The correct payload format (after testing and verifying manually) is:

razorpay_invoice_id | razorpay_invoice_receipt | razorpay_invoice_status | razorpay_payment_id

You can verify the signature like this in Node.js:

const crypto = require("crypto");

const secret = "YOUR_KEY_SECRET";
const data = "inv_XXXX|receipt_XXXX|paid|pay_XXXX";

const expectedSignature = crypto
  .createHmac("sha256", secret)
  .update(data)
  .digest("hex");

// Compare expectedSignature with razorpay_signature
Alternatives

No response

Additional Information

Please consider:

  • Adding a utility method in the SDK for validatePaymentVerification().

  • Updating the docs (paymentVerification.md) to include invoice verification as well.

PR
  • #451

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with paymentVerification.md and the SDK's proposed validatePaymentVerification() utility, then review PR #451 to understand the work already underway. Done means invoice payment verification is covered in the SDK and documented alongside the existing order-based flow, with the supplied invoice fields and payload format addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, documentation, payments, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.