Git Product home page Git Product logo

Comments (10)

MrSpark2591 avatar MrSpark2591 commented on September 1, 2024 2

Closing this issue, As I have figured out that the payment signature is generated using live mode secret key even though you are in test mode and the order was generated in test mode.

So if you want to check the Payment signature always use Live mode secret key.
Above code will work if you use Live mode secret key.

from razorpay-node.

harman28 avatar harman28 commented on September 1, 2024

@MrSpark2591 Looks like you're generating the signature using payment_id|order_id as the plaintext string, but the doc mentions that the order is order_id|payment_id. Essentially, the keys are sorted before using them for signing. So just changing the order should work for you.

Ideally this package should have an validateSignature method that just takes care of that sorting, but it doesn't seem to have one yet. Will try and get that added. Thanks!

from razorpay-node.

MrSpark2591 avatar MrSpark2591 commented on September 1, 2024
let generatedSignature = crypto
  .createHmac(
     "SHA256",
     "my-secret"
).update(payment.razorpay_order_id + '|' +payment.razorpay_payment_id)
.digest('hex');
let isSignatureValid = generatedSignature == payment.razorpay_signature;

@harman28 Tried above code as well. No luck :(

from razorpay-node.

harman28 avatar harman28 commented on September 1, 2024

the payment signature is generated using live mode secret key even though you are in test mode and the order was generated in test mode.

This isn't true. If the order is created and payment are in test mode, the signature too will be generated using your test key secret.

from razorpay-node.

MrSpark2591 avatar MrSpark2591 commented on September 1, 2024

@harman28 Yes, that's what I was expecting. That's why I have reached out to the Razorpay support team and in screen sharing support session surprisingly we got the conclusion. Hope that this gets fixed soon. If you want to track the ticket, Ticket no for the issue is: 720458.

from razorpay-node.

sathyanarayananknila avatar sathyanarayananknila commented on September 1, 2024

@harman28 Whether this thing is fixed ? i am currently recieving two different strings as signature as the above scenario in test mode

from razorpay-node.

ashishtewari avatar ashishtewari commented on September 1, 2024

hey @sathyanarayananknila +1 I am also getting the same issue!
@MrSpark2591 any updates ?

from razorpay-node.

Venkatasamy avatar Venkatasamy commented on September 1, 2024

i am also getting the same issue in test mode

from razorpay-node.

DibyajyotiMishra avatar DibyajyotiMishra commented on September 1, 2024

I am getting undefined values of razorpayOrderId and razorpaySignature from the handler response while working on test mode. So the payment verification fails in the backend. I have been stuck at this for over a day now. Any help is highly appreciated.

This is my code snippet:

`
const launchRazorpay = async () => {
const order = await axios.post"http://localhost:8081/api/subscription/pay");

const { amount, id: order_id, currency } = order.data;

console.log(order);

const options = {
  key: "rzp_test_asdfg345dfCVBN",
  amount: amount,
  currency: currency,
  name: "Razorpay",
  description: "PAY YOUR SUBSCRIPTION FEES",
  image: `${process.env.PUBLIC_URL}/assets/images/logo.png`,
  orderId: order_id,
  handler: function (response) {
    alert(response.razorpay_payment_id);// pay_asd1234
    alert(response.razorpay_order_id);// undefined
    alert(response.razorpay_signature);// undefined
  },
  prefill: {
    name: "abc",
    email: "[email protected]",
    contact: "+911234567890",
  },
};
console.log("====================================");
console.log(options.orderId === order_id); // true
console.log(response.razorpay_order_id === order_id);// false
console.log("====================================");
const paymentObject = new window.Razorpay(options);
paymentObject.open();

};

`

@harman28 sir, any suggestions?

from razorpay-node.

sarb001 avatar sarb001 commented on September 1, 2024

I have already Tried all the Possible Ways .
Some Refers - Normal verification using comparison , while in one Doc of Razorpay -
https://github.com/razorpay/razorpay-node/blob/master/documents/paymentVerfication.md
they used this ( validatePaymentverification ) method for subscription ( what i'm using for )
.Doesn't work for me. Gives Error - ((( order_id or sub_id is mandatory ))) .
Even Solution gives in Docs where used sub_id gives Error --- https://razorpay.com/docs/api/payments/subscriptions/#payment-verification
At verification Section
Any Suggestion or Devs have used sub_id insted of order_id to make payment ???
Any Suggestion will be Helpful ??

from razorpay-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.