flutter-stripe / flutter_stripe

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

GooglePayButton is not clickable with Flutter 3.13 #1393

Open letsar opened 1 year ago

letsar commented 1 year ago

After upgrading to Flutter 3.13 we can no longer click on GooglePayButton.

To Reproduce Steps to reproduce the behavior:

  1. Install Flutter 3.13
  2. Run the code on this repo: https://github.com/flutter-stripe/flutter_stripe/tree/main/example
  3. Expand the Wallets section and then click on Google Pay item
  4. Click on the Google Pay button
  5. Nothing happens

Expected behavior We should be able to click on the Google Pay button.

Smartphone / tablet

Additional context I think this is more a Flutter issue, since it worked in a previous version (tested in 3.7), and it's maybe linked to PlatformViewLink. But in case there is a workaround, or you believe it's from this package, I created this issue.

remonh87 commented 1 year ago

Can you try it with another device than the one plus? I did try it on an Google pixel4a and the callback is executed for me .

letsar commented 1 year ago

Hi @remonh87, we tried with at least two different phones. I asked for the other model. On which version is your Google Pixel 4a? Maybe it's also related to a specific Android version.

remonh87 commented 1 year ago

Mine is a pixel4a on Android 13

letsar commented 1 year ago

The other phone where it does not work is a Xiaomi redmi note 11 with Android 12, so it's not because of the Android version since it works with yours which is on Android 13 like mine.

leewrigg commented 1 year ago

We're also experiencing this issue on Flutter 3.13

remonh87 commented 1 year ago

@letsar I see that you have contact with the flutter team. I can help creating an example repo if needed but you have to test.

In the mean time can you run the example app (google pay Stripe in wallets) on branch test-android-view . Maybe it is in the expensive androidview that we are using

letsar commented 1 year ago

Hi @remonh87, it would be really helpful if you could create an minimal reproducible repo which I could test, thank you very much.

I tested the branch test-android-view and I have the same issue, the button is not clickable.

remonh87 commented 1 year ago

created: https://github.com/remonh87/platform_view_test .

Can you also try it out by commenting out layout.initialize() line 27 on NativeView.kt and press in the middle of the screen. My assumption is that it will work then and you will see pressed in the console

letsar commented 1 year ago

Thanks @remonh87!

So I tested the repo you created and it does nothing when I click on NativeButton. But as you predicted, I can see tapped in the console when I comment layout.initialize(). What is your assumption? Can we safely say that it's a Flutter issue?

remonh87 commented 1 year ago

yes I think so I will comment on the Flutter issue that you created!

letsar commented 1 year ago

Thank you so much @remonh87, have a nice day.

remonh87 commented 1 year ago

I had a hunch today and pushed a potential fix to test-android-view can you test it ? It did fix the issue on the repository I did for Flutter.

letsar commented 1 year ago

Sadly it still doesn't work on this branch :-(

jooikwanw commented 1 year ago

I am having the same issue too. On the emulator and Flutter 3.13.1

I also tried test-android-view branch and the button does not do anything when pressed.

Trying on Flutter 3.10.6 to see if theres any difference -> When I click it, I get these logs

D/TrafficStats(11894): tagSocket(96) with statsTag=0xffffffff, statsUid=-1
E/JavaBinder(11894): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1132)
W/GmsClient(11894): IGmsServiceBroker.getService failed
W/GmsClient(11894): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
W/GmsClient(11894):     at android.os.BinderProxy.transactNative(Native Method)
W/GmsClient(11894):     at android.os.BinderProxy.transact(BinderProxy.java:584)
W/GmsClient(11894):     at com.google.android.gms.common.internal.zzac.getService(com.google.android.gms:play-services-basement@@18.0.0:8)
W/GmsClient(11894):     at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(com.google.android.gms:play-services-basement@@18.0.0:14)
W/GmsClient(11894):     at com.google.android.gms.common.api.internal.zabt.run(com.google.android.gms:play-services-base@@18.0.1:7)
W/GmsClient(11894):     at android.os.Handler.handleCallback(Handler.java:942)
W/GmsClient(11894):     at android.os.Handler.dispatchMessage(Handler.java:99)
W/GmsClient(11894):     at android.os.Looper.loopOnce(Looper.java:201)
W/GmsClient(11894):     at android.os.Looper.loop(Looper.java:288)
W/GmsClient(11894):     at android.os.HandlerThread.run(HandlerThread.java:67)
E/JavaBinder(11894): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1132)
W/GmsClient(11894): IGmsServiceBroker.getService failed
W/GmsClient(11894): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
W/GmsClient(11894):     at android.os.BinderProxy.transactNative(Native Method)
W/GmsClient(11894):     at android.os.BinderProxy.transact(BinderProxy.java:584)
W/GmsClient(11894):     at com.google.android.gms.common.internal.zzac.getService(com.google.android.gms:play-services-basement@@18.0.0:8)
W/GmsClient(11894):     at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(com.google.android.gms:play-services-basement@@18.0.0:14)
W/GmsClient(11894):     at com.google.android.gms.common.api.internal.zabt.run(com.google.android.gms:play-services-base@@18.0.1:7)
W/GmsClient(11894):     at android.os.Handler.handleCallback(Handler.java:942)
W/GmsClient(11894):     at android.os.Handler.dispatchMessage(Handler.java:99)
W/GmsClient(11894):     at android.os.Looper.loopOnce(Looper.java:201)
W/GmsClient(11894):     at android.os.Looper.loop(Looper.java:288)
W/GmsClient(11894):     at android.os.HandlerThread.run(HandlerThread.java:67)
E/JavaBinder(11894): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1132)
W/GmsClient(11894): IGmsServiceBroker.getService failed
W/GmsClient(11894): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
tinrunje commented 1 year ago

I can confirm this issue exists on both Xiaomi devices and One Plus devices. Even if you just attempt to call the bottom sheet to insert a card it will not appear on those devices.

urielvexi commented 11 months ago

Same problem in my pixel 3a with Android 12 and Oneplus nord n100 with Android 11, I tried your repo @remonh87 platform_view_test where it works with commit create possible fix for layout to be clickable but without it, it did nothing when tapped, I did't test branch test-android-view because I could not find it

manandhar-aarya commented 11 months ago

I am facing this issue with Flutter 3.16.3 too with device Samsung Galaxy A13, Android Version 13

Flutter doctor logs:

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.3, on macOS 14.1.2 23B92 darwin-arm64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.80.2) [✓] Connected device (3 available) [✓] Network resources

dependencies: stripe_js: 3.3.0 flutter_stripe: 9.6.0 flutter_stripe_web: 4.6.0


I downgraded flutter to version 3.10.4 for test and then it works. I cannot downgrade to 3.10.4 at the moment because I want to use stripe-express and the latest version of flutter_stripe.

ziagit commented 11 months ago

I'm having same issue. It was working in flutter 3.10 after upgrading to 3.16 it does not working. I tested on Samsung A12 Android 12.

Please fix this issue.

ziagit commented 11 months ago

I am facing this issue with Flutter 3.16.3 too with device Samsung Galaxy A13, Android Version 13

Flutter doctor logs:

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.3, on macOS 14.1.2 23B92 darwin-arm64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.80.2) [✓] Connected device (3 available) [✓] Network resources

dependencies: stripe_js: 3.3.0 flutter_stripe: 9.6.0 flutter_stripe_web: 4.6.0

I downgraded flutter to version 3.10.4 for test and then it works. I cannot downgrade to 3.10.4 at the moment because I want to use stripe-express and the latest version of flutter_stripe.

@manandhar-aarya could you solve this issue?

manandhar-aarya commented 11 months ago

I am facing this issue with Flutter 3.16.3 too with device Samsung Galaxy A13, Android Version 13 Flutter doctor logs: Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.3, on macOS 14.1.2 23B92 darwin-arm64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.80.2) [✓] Connected device (3 available) [✓] Network resources dependencies: stripe_js: 3.3.0 flutter_stripe: 9.6.0 flutter_stripe_web: 4.6.0 I downgraded flutter to version 3.10.4 for test and then it works. I cannot downgrade to 3.10.4 at the moment because I want to use stripe-express and the latest version of flutter_stripe.

@manandhar-aarya could you solve this issue?

no, for now i am using flutter v3.10 for android and v3.13 for web and ios.

ziagit commented 11 months ago

I am facing this issue with Flutter 3.16.3 too with device Samsung Galaxy A13, Android Version 13 Flutter doctor logs: Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.3, on macOS 14.1.2 23B92 darwin-arm64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.80.2) [✓] Connected device (3 available) [✓] Network resources dependencies: stripe_js: 3.3.0 flutter_stripe: 9.6.0 flutter_stripe_web: 4.6.0 I downgraded flutter to version 3.10.4 for test and then it works. I cannot downgrade to 3.10.4 at the moment because I want to use stripe-express and the latest version of flutter_stripe.

@manandhar-aarya could you solve this issue?

no, for now i am using flutter v3.10 for android and v3.13 for web and ios.

Ok, What version of flutter_stripe are you using with flutter 3.10? Have you tested with Android above 12?

manandhar-aarya commented 11 months ago

these are the versions i am using:

stripe_js: 3.3.0 flutter_stripe: 9.5.0+1 flutter_stripe_web: 4.5.0

and yes i tried on android 13 and it seems to work.

remonh87 commented 11 months ago

The problem is that there is regression from Flutter engine and there is little we can do ourselves about it. The paybutton is made by Stripe and the issue is in the flutter engine. As temp work around I would recommend: https://github.com/flutter-stripe/flutter_stripe/blob/main/example/lib/screens/wallets/google_pay_screen.dart or use the paymentsheet . I will ask some help from the stripe team but I do not expect this issue to be solved quickly.

ziagit commented 11 months ago

The problem is that there is regression from Flutter engine and there is little we can do ourselves about it. The paybutton is made by Stripe and the issue is in the flutter engine. As temp work around I would recommend: https://github.com/flutter-stripe/flutter_stripe/blob/main/example/lib/screens/wallets/google_pay_screen.dart or use the paymentsheet . I will ask some help from the stripe team but I do not expect this issue to be solved quickly.

Didn't you solve this issue in v10.0.0. Cannot use pay plugin.

urielvexi commented 11 months ago

The problem is that there is regression from Flutter engine and there is little we can do ourselves about it. The paybutton is made by Stripe and the issue is in the flutter engine. As temp work around I would recommend: https://github.com/flutter-stripe/flutter_stripe/blob/main/example/lib/screens/wallets/google_pay_screen.dart or use the paymentsheet . I will ask some help from the stripe team but I do not expect this issue to be solved quickly.

Didn't you solve this issue in v10.0.0. Cannot use pay plugin.

other work around could be to use:

Stack(
    children: [
        Stripe.PlatformPayButton(
            onPressed: () {},
        ),
        InkWell(
            onTap: controller.payWithGooglePay,
            child: Container(),
        ),
    ],
);

instead of:

Stripe.PlatformPayButton(
    onPressed: controller.payWithGooglePay,
),
ziagit commented 10 months ago

these are the versions i am using:

stripe_js: 3.3.0 flutter_stripe: 9.5.0+1 flutter_stripe_web: 4.5.0

and yes i tried on android 13 and it seems to work.

Do you use as I do? because my code works only on android 12 and below

 @override
  Widget build(BuildContext context) {
    if (defaultTargetPlatform == TargetPlatform.android)
      return Padding(
        padding: const EdgeInsets.fromLTRB(14, 8, 14, 8),
        child: SizedBox(
          height: 65,
          child: PlatformPayButton(
            onPressed: _handlePayPress,
          ),
        ),
      );
    else
      return SizedBox();
  }

   Future<void> _handlePayPress() async {
   print("Google pay button pressed!");
}
ziagit commented 10 months ago

The problem is that there is regression from Flutter engine and there is little we can do ourselves about it. The paybutton is made by Stripe and the issue is in the flutter engine. As temp work around I would recommend: https://github.com/flutter-stripe/flutter_stripe/blob/main/example/lib/screens/wallets/google_pay_screen.dart or use the paymentsheet . I will ask some help from the stripe team but I do not expect this issue to be solved quickly.

Didn't you solve this issue in v10.0.0. Cannot use pay plugin.

other work around could be to use:

Stack(
    children: [
        Stripe.PlatformPayButton(
            onPressed: () {},
        ),
        InkWell(
            onTap: controller.payWithGooglePay,
            child: Container(),
        ),
    ],
);

instead of:

Stripe.PlatformPayButton(
    onPressed: controller.payWithGooglePay,
),

Have you tested?

PeterMX commented 10 months ago

The problem is that there is regression from Flutter engine and there is little we can do ourselves about it. The paybutton is made by Stripe and the issue is in the flutter engine. As temp work around I would recommend: https://github.com/flutter-stripe/flutter_stripe/blob/main/example/lib/screens/wallets/google_pay_screen.dart or use the paymentsheet . I will ask some help from the stripe team but I do not expect this issue to be solved quickly.

Didn't you solve this issue in v10.0.0. Cannot use pay plugin.

other work around could be to use:

Stack(
    children: [
        Stripe.PlatformPayButton(
            onPressed: () {},
        ),
        InkWell(
            onTap: controller.payWithGooglePay,
            child: Container(),
        ),
    ],
);

instead of:

Stripe.PlatformPayButton(
    onPressed: controller.payWithGooglePay,
),

@ziagit I did test it, looks like it works:

about the button design, I did a PR #1566 to fix it, I don't know if it is the design you are talking about

ziagit commented 10 months ago

InkWell( onTap: controller.payWithGooglePay, child: Container(), ),

@PeterMX You tested in live or test mode?

How you declared controller I couldn't find any doc related to that?

Stripe.PlatformPayButton is not defined instead I use PlatformPayButton directly.

  Widget build(BuildContext context) {
    if (defaultTargetPlatform == TargetPlatform.android)
      return Padding(
          padding: const EdgeInsets.all(20.0),
          child: SizedBox(
            height: 65,
            child: Stack(
              children: [
                PlatformPayButton(
                  onPressed: () {},
                ),
                InkWell(
                  onTap: () => _handlePayPress(),
                  child: Container(),
                )
              ],
            ),
          ));
    else
      return SizedBox();
  }

  Future<void> _handlePayPress() async {
      final paymentMethod =
          await Stripe.instance.createPlatformPayPaymentMethod(
        params: PlatformPayPaymentMethodParams.googlePay(
          googlePayParams: GooglePayParams(
            merchantCountryCode: "CA",
            currencyCode: "CAD",
            merchantName: "Tingsapp",
            isEmailRequired: true,
            testEnv: false,
          ),
          googlePayPaymentMethodParams: GooglePayPaymentMethodParams(
            amount: constPrice,
            billingAddressConfig:
                GooglePayBillingAddressConfig(isRequired: true),
            shippingAddressConfig:
                GooglePayShippingAddressConfig(isRequired: true),
          ),
        ),
      );
      handlePaymentMethod(context, paymentMethod);
}

It works in Test mode but not in live mode I get Authentication Error when I click the button. Don't you get any error in live mode if you have tested in live?

leetcoder314 commented 10 months ago

The problem is that there is regression from Flutter engine and there is little we can do ourselves about it. The paybutton is made by Stripe and the issue is in the flutter engine. As temp work around I would recommend: https://github.com/flutter-stripe/flutter_stripe/blob/main/example/lib/screens/wallets/google_pay_screen.dart or use the paymentsheet . I will ask some help from the stripe team but I do not expect this issue to be solved quickly.

What is the difference between google_pay_screen.dart vs google_pay_stripe_screen.dart?

rahulrmishra commented 8 months ago

Any updates on this or by when will this be resolved? Is anyone looking into the issue?