`Body:
I am using the razorpay_flutter plugin (version 1.3.7) in my Flutter app (SDK version 3.10.0). I am encountering an issue where, after initiating a payment, the app restarts unexpectedly on a specific Android 12 device. The payment is processed, and money is deducted, but no success or failure response is returned, and the app restarts from the main function. This issue only happens on a particular Android 12 device, while other devices handle the transaction successfully.
Here is the code I’m using to open Razorpay’s payment interface:
_razorpay = Razorpay();
var options = {
'key': AppSettings.appInfo!.razorpayMerchantId,
'amount': (AppSettings.appInfo!.razorPayAmountTestOneRupee == true || true)
? 100
: widget.totalAmount == null || widget.totalAmount! < 1
? 100
: "${widget.totalAmount}00",
'name': AppSettings.appInfo!.organizationName,
'description': '${AppSettings.appInfo!.organizationName} Premium Services',
'order_id': "${data["DETAILS"]["id"]}",
'prefill': {
'contact': AppSettings.appInfo!.userMobileNumber,
'email': controllerEmail.text.isEmpty
? '[email protected]'
: (controllerEmail.text).contains(".com")
? controllerEmail.text
: "${controllerEmail.text}.com",
}
};
try {
_razorpay!.open(options);
} catch (e) {
AppSettings.displayLongErrorToast("razorpay exception ${e}");
debugPrint(e.toString());
}
I also handle the responses as follows:
void _handlePaymentSuccess(PaymentSuccessResponse response) async {
// Handling success
}
void _handlePaymentError(PaymentFailureResponse response) async {
// Handling error
}
void _handleExternalWallet(ExternalWalletResponse response) {
// Handling external wallet
}
Aftr payment done getting this image
Error Logs:
E/com.razorpay.checkout(6047): Webview JS Error: Uncaught ReferenceError: upiIntentResponse is not defined I/chromium(6047): [INFO:CONSOLE(1)] "Uncaught ReferenceError: upiIntentResponse is not defined"
Payment succeeds (money is deducted), but no success or failure callback is received.
1.The app restarts and loads the main function.
2.This issue happens only on a specific Android 12 device(narzo 50A).
3.The same code works perfectly on other devices.
What I’ve tried:
1.I’ve verified that the Razorpay integration is correct, and I’m handling the callbacks as expected.
2.Debugging shows no additional errors or logs besides the WebView JS error.
Any suggestions on how to resolve this issue or why it might be happening on only one device?
Pooja is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.