razorpay / razorpay-flutter

Razorpay Flutter Plugin
MIT License
107 stars 150 forks source link

leaked IntentReceiver - Are you missing a call to unregisterReceiver() #148

Closed pratikbutani closed 3 years ago

pratikbutani commented 3 years ago

Description

I am implementing Razorpay in Flutter. I have done everything perfectly by following code:

var options = {
      "key" : "rzp_test_hqM123oPlb7W1g",
      "amount" : num.parse(textEditingController.text)*100,
      "name" : "Sample App",
      "description" : "Payment for the some random product",
      "prefill" : {
        "contact" : "2323232323",
        "email" : "shdjsdh@gmail.com"
      },
      "external" : {
        "wallets" : ["paytm"]
      }
    };

    try{
      razorpay.open(options);
    }catch(e){
      print(e.toString());
    }

But I am getting the following error when I open the Razorpay dialog for the first time. And it's not open the dialog a second time When I tap the button again.

Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.CheckoutPresenterImpl$1@53b1477 that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(30865): android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.CheckoutPresenterImpl$1@53b1477 that was originally registered here. Are you missing a call to unregisterReceiver()?

Flutter Version :

Flutter 1.22.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision 9b2d32b605 (7 weeks ago) • 2021-01-22 14:36:39 -0800 Engine • revision 2f0af37152 Tools • Dart 2.10.5

AndroidStudio: 4.1.2

sumedht commented 3 years ago

@pratikbutani We are looking into this issue. Will release a new version with a fix soon.

pratikbutani commented 3 years ago

Okay, Thank you @sumedht Until any trick to prevent this error?

sumedht commented 3 years ago

@pratikbutani No not have any trick

adityaasthana1 commented 3 years ago

Is there any solution? I am facing the same issue.

the-kool-sk commented 3 years ago

Any update on this team?

adityaasthana1 commented 3 years ago

@the-kool-sk I got this similar error in Android (JAVA). The actual problem was, I was using Razorpay Checkout in a fragment which is not allowed. The Checkout & PaymentListener should be implemented in an Activity and not in a Fragment, this solved my problem. I guess when you further pass the data from the Activity to Fragment, this error is generated.

EDIT: I don't know if this helps/works for you or not, but just thought to let you know (if it helps). GoodLuck!

the-kool-sk commented 3 years ago

@adityaasthana1 Actually I am staring the checkout process in flutter view. So I am not sure whether sdk uses activity or fragment internally for checkout. I cannot specify to start the process in activity... thanks for support though.

irshadios commented 3 years ago

I'm getting the same error

I/zygote64(12716): Do partial code cache collection, code=243KB, data=160KB I/zygote64(12716): After code cache collection, code=243KB, data=160KB I/zygote64(12716): Increasing code cache capacity to 1024KB I/zygote64(12716): Compiler allocated 8MB to compile void android.view.ViewRootImpl.performTraversals() W/System.err(12716): org.json.JSONException: No value for order_id W/System.err(12716): at org.json.JSONObject.get(JSONObject.java:392) W/System.err(12716): at com.razorpay.Lumberjack.getValueFromJsonObject(Lumberjack.java:418) W/System.err(12716): at com.razorpay.Lumberjack.addPropertyFromJSONObject(Lumberjack.java:402) W/System.err(12716): at com.razorpay.Lumberjack.addFilteredPropertiesFromPayload(Lumberjack.java:458) W/System.err(12716): at com.razorpay.AnalyticsUtil.addFilteredPropertiesFromPayload(AnalyticsUtil.java:107) W/System.err(12716): at com.razorpay.CheckoutPresenterImpl.addAnalyticsData(CheckoutPresenterImpl.java:887) W/System.err(12716): at com.razorpay.OtpElfCheckoutPresenterImpl.addAnalyticsData(OtpElfCheckoutPresenterImpl.java:171) W/System.err(12716): at com.razorpay.CheckoutPresenterImpl.onSubmit(CheckoutPresenterImpl.java:910) W/System.err(12716): at com.razorpay.CheckoutBridge$10.secure(CheckoutBridge.java:157) W/System.err(12716): at com.razorpay.CheckoutPresenterImpl.executeWebViewCallback(CheckoutPresenterImpl.java:1221) W/System.err(12716): at com.razorpay.CheckoutPresenterImpl.access$700(CheckoutPresenterImpl.java:49) W/System.err(12716): at com.razorpay.CheckoutPresenterImpl$17.run(CheckoutPresenterImpl.java:1207) W/System.err(12716): at android.os.Handler.handleCallback(Handler.java:790) W/System.err(12716): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err(12716): at android.os.Looper.loop(Looper.java:192) W/System.err(12716): at android.app.ActivityThread.main(ActivityThread.java:6754) W/System.err(12716): at java.lang.reflect.Method.invoke(Native Method) W/System.err(12716): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549) W/System.err(12716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) D/com.razorpay.checkout(12716): {"key":"NTZmNWIwNGZhODc1MmUyY2YxOTM5NmM0","events":[{"event":"ch:and_checkout:activity:init_start","timestamp":"1620707167","properties":{"local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1}},{"event":"assist:and_error_log","timestamp":"1620707167","properties":{"error_message":"No value for send_sms_hash","error_level":"error:exception","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1}},{"event":"assist:and_error_log","timestamp":"1620707168","properties":{"error_message":"Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference","error_level":"critical","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N"}},{"event":"assist:and_error_log","timestamp":"1620707168","properties":{"error_message":"No dash options defined","error_level":"error","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"framework":"flutter","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true}}},{"event":"assist:and_error_log","timestamp":"1620707168","properties":{"error_message":"No value for theme","error_level":"error","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"framework":"flutter","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true}}},{"event":"assist:and_perm:sms_already:not:granted","timestamp":"1620707168","properties":{"local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"framework":"flutter","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true}}},{"event":"assist:and_perm:sms_already:not:granted","timestamp":"1620707168","properties":{"local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"framework":"flutter","OTPElf Version":"","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true}}},{"event":"ch:and_cardsaving_start","timestamp":"1620707168","properties":{"local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"payment_attempt":1,"framework":"flutter","OTPElf Version":"","contact":"7829717247","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{" D/com.razorpay.checkout(12716): Sending data to lumberjack D/com.razorpay.checkout(12716): Response from lumberjack: D/PhoneWindow(12716): DEBUG_ALIENSCREEN:getRotation mRotation=0 I/DecorView(12716): setWindowBackground mBackgroundPadding = Rect(0, 0 - 0, 0), mFramePadding = Rect(0, 0 - 0, 0), pkg = com.moden.moden D/com.razorpay.checkout(12716): RzpAssist onPageStarted: https://api.razorpay.com/v1/payments/create/checkout D/com.razorpay.checkout(12716): setPaymentID called: pay_H9LxXZKsXjdZeJ I/TouchMotionHandler(12716): handler onAttached I/TouchMotionHandler(12716): handler onDetached D/com.razorpay.checkout(12716): not magic E/com.razorpay.checkout(12716): Webview JS Error: Uncaught SyntaxError: Invalid or unexpected token I/chromium(12716): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Invalid or unexpected token", source: https://api.razorpay.com/v1/payments/create/checkout (1) I/zygote64(12716): Compiler allocated 8MB to compile void android.view.ViewRootImpl.performTraversals() E/com.razorpay.checkout(12716): Webview JS Error: Uncaught TypeError: window.getDeviceDetails is not a function I/chromium(12716): [INFO:CONSOLE(1)] "Uncaught TypeError: window.getDeviceDetails is not a function", source: https://api.razorpay.com/v1/payments/create/checkout (1) D/PhoneWindow(12716): DEBUG_ALIENSCREEN:getRotation mRotation=0 I/DecorView(12716): setWindowBackground mBackgroundPadding = Rect(0, 0 - 0, 0), mFramePadding = Rect(0, 0 - 0, 0), pkg = com.moden.moden D/com.razorpay.checkout(12716): RzpAssist onPageStarted: https://api.razorpay.com/v1/gateway/mocksharp/payment?key_id=rzp_test_eG4FSYzkpjfD5N I/TouchMotionHandler(12716): handler onAttached I/TouchMotionHandler(12716): handler onDetached D/com.razorpay.checkout(12716): not magic E/com.razorpay.checkout(12716): Webview JS Error: Uncaught SyntaxError: Invalid or unexpected token I/chromium(12716): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Invalid or unexpected token", source: https://api.razorpay.com/v1/gateway/mocksharp/payment?key_id=rzp_test_eG4FSYzkpjfD5N (1) E/com.razorpay.checkout(12716): Webview JS Error: Uncaught TypeError: window.getDeviceDetails is not a function I/chromium(12716): [INFO:CONSOLE(1)] "Uncaught TypeError: window.getDeviceDetails is not a function", source: https://api.razorpay.com/v1/gateway/mocksharp/payment?key_id=rzp_test_eG4FSYzkpjfD5N (1) D/PhoneWindow(12716): DEBUG_ALIENSCREEN:getRotation mRotation=0 I/DecorView(12716): setWindowBackground mBackgroundPadding = Rect(0, 0 - 0, 0), mFramePadding = Rect(0, 0 - 0, 0), pkg = com.moden.moden D/com.razorpay.checkout(12716): RzpAssist onPageStarted: https://api.razorpay.com/v1/payments/pay_H9LxXZKsXjdZeJ/callback/8bd8be14f8e587c56f87852704eb97451bc0968c/rzp_test_eG4FSYzkpjfD5N?status=authorized&token_recurring_status=rejected&language_code=en I/TouchMotionHandler(12716): handler onAttached D/com.razorpay.checkout(12716): oncomplete JavascriptInterface I/TouchMotionHandler(12716): handler onDetached D/com.razorpay.checkout(12716): not magic E/com.razorpay.checkout(12716): Webview JS Error: Uncaught SyntaxError: Invalid or unexpected token I/chromium(12716): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Invalid or unexpected token", source: https://api.razorpay.com/v1/payments/pay_H9LxXZKsXjdZeJ/callback/8bd8be14f8e587c56f87852704eb97451bc0968c/rzp_test_eG4FSYzkpjfD5N?status=authorized&token_recurring_status=rejected&language_code=en (1) D/com.razorpay.checkout(12716): {"key":"NTZmNWIwNGZhODc1MmUyY2YxOTM5NmM0","events":[{"event":"assist:and_rzpassist_page:start","timestamp":"1620707265","properties":{"url":"https:\/\/api.razorpay.com\/v1\/payments\/create\/checkout","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"method":"card","card_number":"458546","payment_attempt":1,"amount":606600,"framework":"flutter","OTPElf Version":"","contact":"+917829717247","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true},"email":"gaurav.kumar@example.com"}},{"event":"ch:and_payment:id_attached","timestamp":"1620707265","properties":{"local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"method":"card","card_number":"458546","payment_id":"pay_H9LxXZKsXjdZeJ","payment_attempt":1,"amount":606600,"framework":"flutter","OTPElf Version":"","contact":"+917829717247","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true},"email":"gaurav.kumar@example.com"}},{"event":"assist:and_rzpassist_page:finish","timestamp":"1620707265","properties":{"page_load_time":0.234330573,"url":"https:\/\/api.razorpay.com\/v1\/payments\/create\/checkout","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"method":"card","card_number":"458546","payment_id":"pay_H9LxXZKsXjdZeJ","payment_attempt":1,"amount":606600,"framework":"flutter","OTPElf Version":"","contact":"+917829717247","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true},"email":"gaurav.kumar@example.com"}},{"event":"ch:and_js:console_error","timestamp":"1620707265","properties":{"line_number":"1","source_id":"https:\/\/api.razorpay.com\/v1\/payments\/create\/checkout","message":"Uncaught SyntaxError: Invalid or unexpected token","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"method":"card","card_number":"458546","payment_id":"pay_H9LxXZKsXjdZeJ","payment_attempt":1,"amount":606600,"framework":"flutter","OTPElf Version":"","contact":"+917829717247","merchant_package":"com.moden.moden","merchant_key":"rzp_test_eG4FSYzkpjfD5N","merchant options":{"amount":606600,"external":{"wallets":["paytm","phonepe","gpay"]},"prefill":{"contact":"7829717247","email":"gaurav.kumar@example.com"},"name":"","description":"Fine T-Shirt","currency":"INR","key":"rzp_test_eG4FSYzkpjfD5N","redirect":true},"email":"gaurav.kumar@example.com"}},{"event":"ch:and_js:console_error","timestamp":"1620707265","properties":{"line_number":"1","source_id":"https:\/\/api.razorpay.com\/v1\/payments\/create\/checkout","message":"Uncaught TypeError: window.getDeviceDetails is not a function","local_order_id":"G8KulB94c9wy2k","local_payment_id":"G8KulBPrCHQvbJ","merchant_app_name":"moden","merchant_app_version":"1.0.0","merchant_app_build":1,"method":"card","card_number":"458546","payment_id":"pay_H9LxXZKsXjdZeJ","payment_attempt":1,"amount":606600,"framework":"flutter","OTPElf Version":"","contact":"+917829717247","merch D/com.razorpay.checkout(12716): Sending data to lumberjack I/flutter (12716): success Instance of 'PaymentSuccessResponse' I/SurfaceView(12716): updateSystemUiVisibility, blackBackground = false, viewVisibility = 0, appBounds = Rect(0, 0 - 720, 1520), mScreenRect = Rect(0, 0 - 720, 1436), surface = io.flutter.embedding.android.FlutterSurfaceView{fe28ac0 V.E...... ........ 0,0-720,1436} E/com.razorpay.checkout(12716): Webview JS Error: Uncaught TypeError: window.getDeviceDetails is not a function I/chromium(12716): [INFO:CONSOLE(1)] "Uncaught TypeError: window.getDeviceDetails is not a function", source: https://api.razorpay.com/v1/payments/pay_H9LxXZKsXjdZeJ/callback/8bd8be14f8e587c56f87852704eb97451bc0968c/rzp_test_eG4FSYzkpjfD5N?status=authorized&token_recurring_status=rejected&language_code=en (1) E/libEGL (12716): call to OpenGL ES API with no current context (logged once per thread) D/com.razorpay.checkout(12716): Response from lumberjack: D/com.razorpay.checkout(12716): CheckoutActivity onDestroy called W/System.err(12716): java.util.ConcurrentModificationException W/System.err(12716): at java.util.ArrayList$Itr.next(ArrayList.java:860) W/System.err(12716): at com.razorpay.SmsAgent.sendSmsPermissionCallBack(SmsAgent.java:110) W/System.err(12716): at com.razorpay.SmsAgent.removeSMSBroadcastReceiver(SmsAgent.java:76) W/System.err(12716): at com.razorpay.RzpAssist.paymentFlowEnd(RzpAssist.java:202) W/System.err(12716): at com.razorpay.OtpElfCheckoutPresenterImpl.addOnFlowEnd(OtpElfCheckoutPresenterImpl.java:130) W/System.err(12716): at com.razorpay.CheckoutPresenterImpl.cleanUpOnDestroy(CheckoutPresenterImpl.java:664) W/System.err(12716): at com.razorpay.BaseCheckoutActivity.onDestroy(BaseCheckoutActivity.java:175) W/System.err(12716): at android.app.Activity.performDestroy(Activity.java:7375) W/System.err(12716): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1255) W/System.err(12716): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4520) W/System.err(12716): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4551) W/System.err(12716): at android.app.ActivityThread.-wrap5(Unknown Source:0) W/System.err(12716): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1743) W/System.err(12716): at android.os.Handler.dispatchMessage(Handler.java:106) W/System.err(12716): at android.os.Looper.loop(Looper.java:192) W/System.err(12716): at android.app.ActivityThread.main(ActivityThread.java:6754) W/System.err(12716): at java.lang.reflect.Method.invoke(Native Method) W/System.err(12716): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549) W/System.err(12716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) W/System.err(12716): java.util.ConcurrentModificationException W/System.err(12716): at java.util.ArrayList$Itr.next(ArrayList.java:860) W/System.err(12716): at com.razorpay.SmsAgent.sendSmsPermissionCallBack(SmsAgent.java:110) W/System.err(12716): at com.razorpay.SmsAgent.removeSMSBroadcastReceiver(SmsAgent.java:76) W/System.err(12716): at com.razorpay.RzpAssist.paymentFlowEnd(RzpAssist.java:202) W/System.err(12716): at com.razorpay.OtpElfCheckoutPresenterImpl.addOnFlowEnd(OtpElfCheckoutPresenterImpl.java:130) W/System.err(12716): at com.razorpay.CheckoutPresenterImpl.cleanUpOnDestroy(CheckoutPresenterImpl.java:664) W/System.err(12716): at com.razorpay.BaseCheckoutActivity.onDestroy(BaseCheckoutActivity.java:175) W/System.err(12716): at android.app.Activity.performDestroy(Activity.java:7375) W/System.err(12716): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1255) W/System.err(12716): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4520) W/System.err(12716): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4551) W/System.err(12716): at android.app.ActivityThread.-wrap5(Unknown Source:0) W/System.err(12716): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1743) W/System.err(12716): at android.os.Handler.dispatchMessage(Handler.java:106) W/System.err(12716): at android.os.Looper.loop(Looper.java:192) W/System.err(12716): at android.app.ActivityThread.main(ActivityThread.java:6754) W/System.err(12716): at java.lang.reflect.Method.invoke(Native Method) W/System.err(12716): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549) W/System.err(12716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) I/TouchMotionHandler(12716): handler onDetached E/com.razorpay.checkout(12716): Webview JS Error: Uncaught ReferenceError: otpPermissionCallback is not defined I/chromium(12716): [INFO:CONSOLE(1)] "Uncaught ReferenceError: otpPermissionCallback is not defined", source: https://api.razorpay.com/v1/payments/pay_H9LxXZKsXjdZeJ/callback/8bd8be14f8e587c56f87852704eb97451bc0968c/rzp_test_eG4FSYzkpjfD5N?status=authorized&token_recurring_status=rejected&language_code=en (1) E/ActivityThread(12716): Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.CheckoutPresenterImpl$1@285ddc6 that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(12716): android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.CheckoutPresenterImpl$1@285ddc6 that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(12716): at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1380) E/ActivityThread(12716): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1140) E/ActivityThread(12716): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1441) E/ActivityThread(12716): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1414) E/ActivityThread(12716): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:629) E/ActivityThread(12716): at com.razorpay.CheckoutPresenterImpl$8.onFinish(CheckoutPresenterImpl.java:764) E/ActivityThread(12716): at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:127) E/ActivityThread(12716): at android.os.Handler.dispatchMessage(Handler.java:106) E/ActivityThread(12716): at android.os.Looper.loop(Looper.java:192) E/ActivityThread(12716): at android.app.ActivityThread.main(ActivityThread.java:6754) E/ActivityThread(12716): at java.lang.reflect.Method.invoke(Native Method) E/ActivityThread(12716): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549) E/ActivityThread(12716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828) E/ActivityThread(12716): Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@d5357aa that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(12716): android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.AutoReadOtpHelper@d5357aa that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(12716): at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1380) E/ActivityThread(12716): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1140) E/ActivityThread(12716): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1441) E/ActivityThread(12716): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1414) E/ActivityThread(12716): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1402) E/ActivityThread(12716): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:616) E/ActivityThread(12716): at com.razorpay.CheckoutPresenterImpl.onSubmit(CheckoutPresenterImpl.java:922) E/ActivityThread(12716): at com.razorpay.CheckoutBridge$10.secure(CheckoutBridge.java:157) E/ActivityThread(12716): at com.razorpay.CheckoutPresenterImpl.executeWebViewCallback(CheckoutPresenterImpl.java:1221) E/ActivityThread(12716): at com.razorpay.CheckoutPresenterImpl.access$700(CheckoutPresenterImpl.java:49) E/ActivityThread(12716): at com.razorpay.CheckoutPresenterImpl$17.run(CheckoutPresenterImpl.java:1207) E/ActivityThread(12716): at android.os.Handler.handleCallback(Handler.java:790) E/ActivityThread(12716): at android.os.Handler.dispatchMessage(Handler.java:99) E/ActivityThread(12716): at android.os.Looper.loop(Looper.java:192) E/ActivityThread(12716): at android.app.ActivityThread.main(ActivityThread.java:6754) E/ActivityThread(12716): at java.lang.reflect.Method.invoke(Native Method) E/ActivityThread(12716): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549) E/ActivityThread(12716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828)

disha-ramchandani commented 3 years ago

@the-kool-sk I got this similar error in Android (JAVA). The actual problem was, I was using Razorpay Checkout in a fragment which is not allowed. The Checkout & PaymentListener should be implemented in an Activity and not in a Fragment, this solved my problem. I guess when you further pass the data from the Activity to Fragment, this error is generated.

EDIT: I don't know if this helps/works for you or not, but just thought to let you know (if it helps). GoodLuck!

Hi, I am coding in Java and facing the same issue. Could you share your modified code? Like how should I pass the data in the activity? I have implemented PaymentResultListener in Activity already.

chintan-isaac commented 3 years ago

@disha-ramchandani Were you able to solve the error?

sumedht commented 3 years ago

Please update to v1.2.6, we have fixed error in this release

adityaasthana1 commented 3 years ago

@disha-ramchandani Sorry for the delayed reply. But as I said, you need to create separate Activity for using the Checkout API. You can implement the PaymentListener on the Activity and have a callback from the Checkout. Then you can pass the data to other Activities or Fragments through SharedPreference or maybe use Parcelable if you don't want your data to persist.

You can check the following code for reference: https://github.com/adityaasthana1/Food_Owl/blob/master/app/src/main/java/com/macht/foodowl/PaymentActivity.java

disha-ramchandani commented 3 years ago

@disha-ramchandani Sorry for the delayed reply. But as I said, you need to create separate Activity for using the Checkout API. You can implement the PaymentListener on the Activity and have a callback from the Checkout. Then you can pass the data to other Activities or Fragments through SharedPreference or maybe use Parcelable if you don't want your data to persist.

You can check the following code for reference: https://github.com/adityaasthana1/Food_Owl/blob/master/app/src/main/java/com/macht/foodowl/PaymentActivity.java

Thank you so much for helping me out. I will check it out.

disha-ramchandani commented 3 years ago

Please update to v1.2.6, we have fixed error in this release

Thank you!

tushar1990 commented 3 years ago

E/ActivityThread: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.CheckoutPresenterImpl$1@f918007 that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Activity com.razorpay.CheckoutActivity has leaked IntentReceiver com.razorpay.CheckoutPresenterImpl$1@f918007 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1596) at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1372) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1526) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1499) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:650) at com.razorpay.CheckoutPresenterImpl$8.onFinish(CheckoutPresenterImpl.java:764) at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:127) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:225) at android.app.ActivityThread.main(ActivityThread.java:7563) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:994)

dependancy implementation 'com.razorpay:checkout:1.6.6'

I am getting this issue in payment activity. also using PaymentResultWithDataListener for getting response on success and failure.

Is there any solution?

raghavguptaeng commented 3 years ago

@adityaasthana1 Actually I am staring the checkout process in flutter view. So I am not sure whether sdk uses activity or fragment internally for checkout. I cannot specify to start the process in activity... thanks for support though.

you just have to pass PaymentSuccessResponse response as an argument to event listners and it will work fine

PKReejesh commented 3 years ago

It is good to check

 @Override
    public void onPaymentError(int i, String s) {
       Log.e(TAG,"onPaymentError:"+s);
    }

Because I got the same error posted here after this method gets called, and addressing that issue in onPaymentError can solve the issue, in my case the api key set with:

checkout.setKeyID("");

was wrong and it gave off the error :

{"code":"BAD_REQUEST_ERROR","description":"The api key provided is invalid","source":"NA","step":"NA","reason":"NA","metadata":{}}

After I gave the correct api key, i was able to see razorpay page.

Dont miss seeing onPaymentError before checking this error, because the long error can easily hide the small error message.