问题
i have been implementing an payment gateway using razorpay
when i tap on success button it gives the razorpaymentId but when i tap on failure it simply redirect me to netbancking payment page without displaying any toast which is defined in onPaymentError
here is my code :--
override fun onPaymentSuccess(razorpayPaymentID: String) {
Toast.makeText(this, "Payment successfully done! $razorpayPaymentID", Toast.LENGTH_SHORT).show()
Log.e("onPaymentSucess", "Payment successfully done! $razorpayPaymentID")
}
override fun onPaymentError(code: Int, response: String) {
Toast.makeText(applicationContext, "Payment failed: "+code+""+response,Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Payment error please try again", Toast.LENGTH_SHORT).show()
try {
Log.e("onPaymentFail","onError: $code")
Toast.makeText(applicationContext, "Payment failed: "+code+""+response,Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Payment error please try again", Toast.LENGTH_SHORT).show()
} catch (e: Exception) {
Log.e("OnPaymentError", "Exception in onPaymentError", e)
}
}
above toast and log is not giving the value of code and response under onpaymentFailure
stacktrace
2021-01-06 19:11:00.738 25542-25542/com.example.razordemo I/TouchMotionHandler: handler onAttached
2021-01-06 19:11:00.779 586-2847/? D/SurfaceFlinger: duplicate layer name: changing com.example.razordemo/com.razorpay.CheckoutActivity to com.example.razordemo/com.razorpay.CheckoutActivity#1
2021-01-06 19:11:00.859 25542-25542/com.example.razordemo D/skia: --- Failed to create image decoder with message 'unimplemented'
2021-01-06 19:11:00.889 25542-25542/com.example.razordemo D/skia: --- Failed to create image decoder with message 'unimplemented'
2021-01-06 19:11:00.952 25542-25542/com.example.razordemo I/TouchMotionHandler: handler onDetached
2021-01-06 19:11:00.959 586-1866/? D/SurfaceFlinger: duplicate layer name: changing Surface(name=fd00b2b com.example.razordemo/com.razorpay.CheckoutActivity)/@0x14ea146 - animation-leash to Surface(name=fd00b2b com.example.razordemo/com.razorpay.CheckoutActivity)/@0x14ea146 - animation-leash#1
2021-01-06 19:11:01.040 25542-25542/com.example.razordemo I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: window.getDeviceDetails is not a function", source: https://api.razorpay.com/v1/checkout/public?version=1.5.16&library=checkoutjs&platform=android&error.description=Payment%20failed (1)
2021-01-06 19:11:01.070 25542-25542/com.example.razordemo I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: window.getDeviceDetails is not a function", source: https://api.razorpay.com/v1/checkout/public?version=1.5.16&library=checkoutjs&platform=android&error.description=Payment%20failed (1)
2021-01-06 19:11:01.124 586-653/? W/SurfaceFlinger: Attempting to set client state on removed layer: com.example.razordemo/com.razorpay.CheckoutActivity#1
2021-01-06 19:11:01.124 586-653/? W/SurfaceFlinger: Attempting to destroy on removed layer: com.example.razordemo/com.razorpay.CheckoutActivity#1
please guide me thanks a lot
回答1:
even i'm getting this problem when i'm cancel payment via UPi id
来源:https://stackoverflow.com/questions/65596957/onpaymentfailure-not-getting-called-in-razorpay