本文介绍了在razorpay中未调用onPaymentFailure的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在使用razorpay实现支付网关
i have been implementing an payment gateway using razorpay
当我点击成功按钮时,它会提供razorpaymentId,但是当我点击失败时,它仅将我重定向到netbancking付款页面,而不会显示onPaymentError
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
这是我的代码:-
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)
}
}
在toast和log之上,没有给出onpaymentFailure下的代码和响应的值
above toast and log is not giving the value of code and response under onpaymentFailure
stacktrace
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
请指导我,谢谢
推荐答案
即使我通过UPi ID取消付款,也遇到了这个问题
even i'm getting this problem when i'm cancel payment via UPi id
这篇关于在razorpay中未调用onPaymentFailure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!