Comments (10)
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.
@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.
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.
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.
@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.
@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.
hey @sathyanarayananknila +1 I am also getting the same issue!
@MrSpark2591 any updates ?
from razorpay-node.
i am also getting the same issue in test mode
from razorpay-node.
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.
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)
- npm install
- `name` field is mandatory in create customer method HOT 3
- Property 'validatePaymentVerification' does not exist on type 'typeof Razorpay' HOT 3
- Razorpay Version 2.9.1 for NodeJS uses Vulnerable Dependencies HOT 4
- Customer Already exists error HOT 13
- cant verify signature HOT 8
- Issue with create customer when customer is already exist and fail_existing value is 0 HOT 1
- [Feature]: Type definition for Webhook Events. HOT 1
- Do we have payment link with qr code HOT 3
- Promise rejection without error in `instance.orders.create()` HOT 1
- Authentication failed in test mode for razorpay connection works in localhost but for same keys fails on server HOT 1
- [Documentation]: Incorrect type in notes type in refund
- [Feature]: Razorpay X support in nodejs SDK HOT 1
- how to update a subscription plan via API
- [Feature]: Create Offers from API HOT 1
- I am unable to make payment through my website in MERN stack HOT 2
- request.body is empty in webhook request
- IP is not required and should not be sent in product configuration node sdk HOT 1
- Invalid Pan field when creating Linked account using razorpay-node
- [Feature]: More responsiveness from maintainers. Maybe take help of contributors? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from razorpay-node.