flutter-stripe / flutter_stripe

Flutter SDK for Stripe.
https://pub.dev/packages/flutter_stripe
913 stars 502 forks source link

Back Button Navigation Issue with Stripe Payment Gateway in Flutter #1822

Open SeemanthWebcastle opened 1 week ago

SeemanthWebcastle commented 1 week ago

I am a Flutter developer integrating Stripe payment gateway into my Flutter application. Following the documentation, I switched from using FlutterActivity to FlutterFragmentActivity in MainActivity.kt. After making this change, the back button functionality in my app stopped working as expected.

Steps to Reproduce:

  1. Modify MainActivity.kt to extend FlutterFragmentActivity instead of FlutterActivity.
  2. Build and run the Flutter app.
  3. Navigate to a screen where Stripe payment is implemented.
  4. Attempt to navigate back using the device's hardware back button.

Expected Behavior: When pressing the back button, the app should navigate back to the previous screen within the app.

Actual Behavior: After switching to FlutterFragmentActivity, pressing the back button navigates the app to the home screen of the device instead of navigating back within the app.

Additional Information:

Possible Cause: The change to FlutterFragmentActivity may have affected the handling of back button events within the Flutter application, possibly due to differences in how FlutterFragmentActivity manages the Flutter view compared to FlutterActivity.

Thank you for your attention to this matter. Please let me know if you require further clarification or additional information to investigate and address this issue effectively.

jonasbark commented 5 days ago

"where Stripe payment is implemented" can you clarify what you mean by that? Payment Sheet? CardField?

Vikkybliz commented 4 days ago

"where Stripe payment is implemented" can you clarify what you mean by that? Payment Sheet? CardField?

Back button closes app when using app instead of going to previous page.

remonh87 commented 2 days ago

Can you provide a reproducible example here? because in my app the backbutton behavior works as expected. Same goes for the example app

shashikantdwivedi commented 10 hours ago

I am a Flutter developer integrating Stripe payment gateway into my Flutter application. Following the documentation, I switched from using FlutterActivity to FlutterFragmentActivity in MainActivity.kt. After making this change, the back button functionality in my app stopped working as expected.

Steps to Reproduce:

  1. Modify MainActivity.kt to extend FlutterFragmentActivity instead of FlutterActivity.
  2. Build and run the Flutter app.
  3. Navigate to a screen where Stripe payment is implemented.
  4. Attempt to navigate back using the device's hardware back button.

Expected Behavior: When pressing the back button, the app should navigate back to the previous screen within the app.

Actual Behavior: After switching to FlutterFragmentActivity, pressing the back button navigates the app to the home screen of the device instead of navigating back within the app.

Additional Information:

  • Flutter version: 3.19.0
  • Stripe SDK version: ^10.1.1

Possible Cause: The change to FlutterFragmentActivity may have affected the handling of back button events within the Flutter application, possibly due to differences in how FlutterFragmentActivity manages the Flutter view compared to FlutterActivity.

Thank you for your attention to this matter. Please let me know if you require further clarification or additional information to investigate and address this issue effectively.

I am facing the similar issue. Back button is closing the app after integrating stripe