razorpay / react-native-razorpay

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

Getting error undefined | undefined while calling RazorpayCheckout.open #334

Closed Abhi0059 closed 3 years ago

Abhi0059 commented 3 years ago

it was working fine before...suddenly i am getting error undefined | undefined while calling RazorpayCheckout.open .. i didn't change anything... i was using react-native-razorpay:2.2.2 and googled about this issue.. some says to update it . so i did react-native-razorpay:2.2.5 but still getting same issue... please help me out.. thanks in advance.

var options = { description: 'Credits towards consultation', image: 'https://i.imgur.com/3g7nmJC.png', currency: 'INR', key: 'xxxxxxx', amount: ${amount}00, name: userName, order_id: 'order_1', prefill: { email: userEmail, contact: userPhone, name: userName, }, theme: {color: '#6699ff'}, }; RazorpayCheckout.open(options) .then((data) => { alert( Success: ${data.razorpay_payment_id}, ); }) .catch((error) => { alert(Error: ${error.code} | ${error.description}); }); }

sumedht commented 3 years ago

@Abhi0059 Getting this issue on iOS or Android? Looks like lib is not imported properly so it's not able to get related classes & hence giving undefine as an error.

Abhi0059 commented 3 years ago

@sumedht i am working on android .. i think it is imported properly because my payments are going to admin panel(razorpay).

vivekshindhe commented 3 years ago

Could you create a sample project where you are able to produce this error and send the same to us? That would be really helpful. The information provided isn't much to go on, and the issue isn't reproducible by us.

Thanks.

Abhi0059 commented 3 years ago

@vivekshindhe ok

Abhi0059 commented 3 years ago

Hi @vivekshindhe i created a sample project where i am getting same issue... where i have to send ?

vivekshindhe commented 3 years ago

Please send it at vivek.shindhe@razorpay.com

Abhi0059 commented 3 years ago

Hi @vivekshindhe Please check sample project at vivek.shindhe@razorpay.com

vivekshindhe commented 3 years ago

@Abhi0059 I just checked the project you shared and it's working just fine. Please try completely uninstalling and cleaning cache before reinstalling and trying this again.

Abhi0059 commented 3 years ago

Hi @vivekshindhe, i run that same code on 3 different android devices.. but still getting same error.. did you checked with same API key which i shared to you?

vivekshindhe commented 3 years ago

@Abhi0059 Yes. I didn't change anything.

Abhi0059 commented 3 years ago

@vivekshindhe i also tried making build for 2 different Systems ... mac and windows but still getting same.. can you please help me out via skype, phone call, google meet any which ever suitable for you.

vivekshindhe commented 3 years ago

@Abhi0059 Sure. Let's connect over a call. Could you please send your email-address that is registered with Razorpay and your Merchant ID to vivek.shindhe@razorpay.com so we can set up this call? Thank you for your patience.

Abhi0059 commented 3 years ago

@vivekshindhe Thanks .. finally i got the issue.. now it is working fine.

vivekshindhe commented 3 years ago

@Abhi0059 Could you please explain what the issue was?? This may help people with the same issue in the future.

Also, closing the issue. Please feel free to open another one if needed.

Thank you.

Abhi0059 commented 3 years ago

Yes @vivekshindhe , the code which i sent you.. i was alerting "${amount}" in (alert(Success: ${data.razorpay_payment_id} ${amount})) which was the issue..here amount is not defined.. so it goes to catch block.. but don't know how it was running at your end.

vivekshindhe commented 3 years ago

I had changed that after seeing there was no variable in that name guessing there was some different code that was missing when creating the sample project. Glad you were able to resolve your issue.

Vishal3474 commented 1 year ago

Can You Send Screenshot