razorpay / react-native-razorpay

React Native wrapper for Razorpay's mobile SDKs
https://www.npmjs.com/package/react-native-razorpay
MIT License
121 stars 107 forks source link

Razorpay cancels payments on Android #403

Closed punndcoder28 closed 1 year ago

punndcoder28 commented 2 years ago

Description

We are facing an issue in our application (more specifically on android platform), where when we are in the payment gateway section on the page that requires us to enter OTP for our card. If the application is moved to the background (for let us say to get the OTP) the payment is cancelled and the error code says BAD_REQUEST_ERROR and the description is Payment processing cancelled by user which should not happen since the action was made to get OTP from SMS without cancelling the gateway page

Razorpay Package Version :

react-native-razorpay: ^2.2.9

Java and Gradle Version (android) :

gradle 4.2.2 java JDK 11

What you did:

If we go to another application or even move the current application to background while we are in the process of entering the OTP, razorpay cancels the payment with the error code and description as stated above

What happened:

The payment failed with error saying the user cancelled the payment. I cannot really provide a screen recording since it would contain card info but the error is very consistent and can easily be reproduced on an android device. We did not face this issue on our iOS app

Steps To Reproduce

  1. Initiate a payment process
  2. Get to the OTP page
  3. Navigate away from the app and open the SMS application
  4. Open the application again

Suggested solution:

I haven't yet dug deeper into the code but will be looking into it and hopefully find the issue

Code example, screenshot, or link to a repository:

This is an email received from razorpay for failure which was not initiated by any user action

image

vivekshindhe commented 2 years ago

@punndcoder28 We don't seem to be able to reproduce this issue. Seems to be more like an issue here. android:launchMode=”singleTask” check if this is present for the mainActivity in your project. This basically means that the activity is getting destroyed the moment it goes out of focus.

punndcoder28 commented 2 years ago

Hi @vivekshindhe . It was indeed present in our project. I shall confirm if that fixes it by tomorrow EOD. Thanks for the reply.

punndcoder28 commented 2 years ago

Hi. Tested with removing the suggested line and it seems to work on our android test devices. Will keep an eye out if the issue again arises

kkyusufk commented 1 year ago

Hey folks, is this issue resolved? If yes then please confirm so it can be closed. Please reach out if this issue still persists.

punndcoder28 commented 1 year ago

Hey @kkyusufk we have not seen this issue till date. Will leave a comment here tagging you if we do encounter this in the future

kkyusufk commented 1 year ago

@punndcoder28 Let's close this issue if it's not reproducible. We would like to close stale issues if they are not coming up anymore. You can open this up again if this shows up.

punndcoder28 commented 1 year ago

Cool. Will reopen this if we come across this anytime again