razorpay / react-native-razorpay

React Native wrapper for Razorpay's mobile SDKs
https://www.npmjs.com/package/react-native-razorpay
MIT License
121 stars 107 forks source link

Unable to get failure response while integrating with the library #416

Closed gani419 closed 1 year ago

gani419 commented 1 year ago

Hi, I am using the latest version of this library (2.2.9) and it's working fine for success response. But I'm not getting any response for failure case like wrong upi (eg: failure@razorpay).

If the payment is success, I'm getting success logger which is data in below. If the payment is failure, I'm not getting any logger, just giving payment failure from the gateway in UI. But nothing in logger which I'm calling.

Below is my razor pay integration,

const handleRazorPay = (response) =>{ try { var options = { description: 'Credits towards consultation', image: 'https://i.imgur.com/3g7nmJC.png', currency: response.currency, key: response.merchant_key, amount: response.amount, name: response.name, order_id: response.order_id, prefill: { email: response.email, contact: response.number, name: 'Razorpay Software', }, theme: {color: '#F37254'}, }; console.log('options:: ', options); RazorpayCheckout.open(options) .then(data => { console.log('data:: ', data); alert('success'); }) .catch(error => { // handle failure console.log( Error Payment cancelled ${error.code} | ${error.description}, ); console.log('Error data:: ', error); }); } catch (error) { console.log('Error in rendering payment gateway:: ', error.message); } }

vivekshindhe commented 1 year ago

@gani419 Can you please check with live keys and a live UPI ID with collect payment when you decline the payment and see if the issue persists?

gani419 commented 1 year ago

Will check and notify.

gani419 commented 1 year ago

Tried now for live credentials. Working for successful transaction but not getting anything for failure transaction (When user declines the request). Just showing retry in gateway ui.

vivekshindhe commented 1 year ago

@gani419 ack. Checking it. Will notify ASAP

vivekshindhe commented 1 year ago

@gani419 tested this on my end, with both live and test keys. It works as expected. If you want the user to not be able to retry the payment, i.e, when the user declines the payment, it'll navigate back to your application after, use the retry config as follows,

retry:{ max_count:4, enabled:false }

gani419 commented 1 year ago

Hi, It's working for me now when I config status: 'created' in options along with retry:{ max_count:4, enabled:false }.

gani419 commented 1 year ago

Thank you for your response...