react-native-razorpay: React Native App crashing on RazorpayCheckout.open

Description

Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest React Native Razorpay plugin release to make sure your issue has not already been fixed.

Razorpay Package Version :

Open Package.json. > ^2.1.35.

Xcode Version (iOS) :

Open Xcode > Go to About Xcode > We are testing only for Android now.

Java and Gradle Version (android) :

Java(1.8.0_171) and Gradle(3.6.1).

What you did:

I am passing the following data to the Razorpay checkout option:- const options = { currency: ‘INR’, key: ‘rzp_test_5OHWyAujiA2dMr’, amount: ‘5000’, name: ‘Test’, order_id: ‘order_F7Fsx1D3swiUbR’, }; RazorpayCheckout.open(options) .then(() => { // success case; }) .catch(() => { // failure case; });

What happened:

.952 14387 14387 E com.razorpay.checkout: Error reading options! 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: org.json.JSONException: No value for send_sms_hash 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at org.json.JSONObject.get(JSONObject.java:392) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at org.json.JSONObject.getBoolean(JSONObject.java:413) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.c__C_.G__G_(:36) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.O_$B_.getOptionsForHandleMessage(:771) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.O_$B_.G__G_(:61798) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.O_$B_$11.run(:727) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at android.app.Activity.runOnUiThread(Activity.java:6282) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.O_$B_.onLoad(:720) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.E$j$.a$P$(:65028) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.O_$B_.a_$P$(:1199) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.O_$B_.Q_$2$(:49) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.razorpay.O_$B_$10.run(:1185) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at android.os.Handler.handleCallback(Handler.java:873) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at android.os.Handler.dispatchMessage(Handler.java:99) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at android.os.Looper.loop(Looper.java:193) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at android.app.ActivityThread.main(ActivityThread.java:6669) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at java.lang.reflect.Method.invoke(Native Method) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 07-14 19:22:07.952 14387 14387 E com.razorpay.checkout: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 07-14 19:22:07.953 14387 14387 W System.err: org.json.JSONException: No value for send_sms_hash 07-14 19:22:07.953 14387 14387 W System.err: at org.json.JSONObject.get(JSONObject.java:392) 07-14 19:22:07.953 14387 14387 W System.err: at org.json.JSONObject.getBoolean(JSONObject.java:413) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.c__C_.G__G_(:36) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.O_$B_.getOptionsForHandleMessage(:771) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.O_$B_.G__G_(:61798) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.O_$B_$11.run(:727) 07-14 19:22:07.953 14387 14387 W System.err: at android.app.Activity.runOnUiThread(Activity.java:6282) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.O_$B_.onLoad(:720) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.E$j$.a$P$(:65028) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.O_$B_.a_$P$(:1199) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.O_$B_.Q_$2$(:49) 07-14 19:22:07.953 14387 14387 W System.err: at com.razorpay.O_$B_$10.run(:1185) 07-14 19:22:07.953 14387 14387 W System.err: at android.os.Handler.handleCallback(Handler.java:873) 07-14 19:22:07.953 14387 14387 W System.err: at android.os.Handler.dispatchMessage(Handler.java:99) 07-14 19:22:07.953 14387 14387 W System.err: at android.os.Looper.loop(Looper.java:193) 07-14 19:22:07.953 14387 14387 W System.err: at android.app.ActivityThread.main(ActivityThread.java:6669) 07-14 19:22:07.953 14387 14387 W System.err: at java.lang.reflect.Method.invoke(Native Method) 07-14 19:22:07.953 14387 14387 W System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 07-14 19:22:07.953 14387 14387 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 07-14 19:22:07

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

1.I pass the payment object to Razorpay Checkout, which leads to crashing of my app.

Suggested solution:

Code example, screenshot, or link to a repository:

Please provide a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

const options = { currency: ‘INR’, key: ‘rzp_test_5OHWyAujiA2dMr’, amount: ‘5000’, name: ‘Test’, order_id: ‘order_F7Fsx1D3swiUbR’, }; RazorpayCheckout.open(options) .then(() => { // success case; }) .catch(() => { // failure case; });

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 44 (13 by maintainers)

Most upvoted comments

A downgrade to react-native-razorpay@2.1.33 helped me solve the issue. Can confirm that the problem exists in com.razorpay:checkout:1.5.18 updated from 1.5.12 about 10 days ago. Would suggest everyone to uninstall latest version (npm uninstall react-native-razorpay) and install 2.1.33 (npm i react-native-razorpay@2.1.33) until the fix is offical.

Fixed it.

Buggy Payload : theme: { color: 'rgb(97,178,68)' }

Proper Payload : theme: { color: '#61b244' }

Thank you.

Temporary Fix. Change the Razorpay checkout version in Your_Project_Path/node_modules/react-native-razorpay/android/build.gradle implementation ‘com.razorpay:checkout:1.5.18’ to implementation ‘com.razorpay:checkout:1.5.12’

Hi,

Fix on my app was pretty basic, might be a different case on your apps. I managed to fix it for my app, the colour param passed in the payload needs to be a six character string and not a three character string , for example if you guys are implementing background colour as black and using a hex colour value then #000 failed without throwing any logs and #000000 works perfectly.