Reputation: 77
I am using the Razorpay payment method in my application. The issue is whenever a customer tries to make a payment on Razorpay it shows me an Authentication Failed error, we have a valid Razorpay Client Id, but still it shows me the Authentication Failed error. Due to the Authentication Failed error I am not able to open the razorpay iframe.
We are showing a web page in the mobile application.
Note: Not all the users are facing this issue, some of our users are facing this issue. Most of the users can make successful payments from our app, but some get this error.
The JS version of RazorPay: https://checkout.razorpay.com/v1/checkout.js
Also, there's no error handler method in Razorpay which handles this error, so we can show user to some another message, they have the below method but it works when the actual payment failed
rzp1.on('payment.failed', function (response){
alert(response.error.description);
});
My code for that
var options = {
"key": "rzp_test_345345345",
"amount": amount, // 2000 paise = INR 20
"name": name,
"description": description,
"modal.backdropclose": false,
"modal.escape": true,
"handler": function(response) {
$("div#contentContainer").show();
var razorpay_payment_id = response.razorpay_payment_id;
if (razorpay_payment_id != '') {
alert(razorpay_payment_id);
}
},
"prefill": {
"email": '[email protected]',
"name": 'test',
"contact": '8529631478'
},
"notes": {
"order_id": "34343",
"payment_type": "Test notes"
},
"theme": {
"color": "#F37254"
},
"modal": {
"ondismiss": function() {
alert('Modal Closed');
}
}
};
var rzp1 = new Razorpay(options);
rzp1.on('payment.failed', function (response){
alert(response.error.description);
});
document.getElementById('pay_now').onclick = function(e) {
rzp1.open();
e.preventDefault();
}
$('#pay_now').trigger('click');
We also contact the razorpay support, but there's not a proper response from their side.
Any help would be grateful for me. Thank you in advanced.
Upvotes: 1
Views: 2919
Reputation: 11
I came across one such problem and the problem was that I was entering wrong key. But as you mentioned that most of your customers are able to make successful payment then it is definitely not the case of incorrect key.
Please do following steps to cross-check things:
.env
file in production, make sure that your js
file is able to access those values properly.KYC
on Razorpay.If problem still exists then problem can only be solved by consulting with Razorpay customer support.
Upvotes: 1