flutter_stripe icon indicating copy to clipboard operation
flutter_stripe copied to clipboard

Google Pay Button is not showing on presentPaymentSheet

Open YoucefSFPlus opened this issue 3 years ago • 1 comments

Describe the bug When I try to call presentPaymentSheet the carForm is showing good but I don't have the Google Pay button. This is how I call it:

  var paymentIntent = await createPaymentIntent(amount, currency);
  await Stripe.instance.initPaymentSheet(
      paymentSheetParameters: SetupPaymentSheetParameters(
    applePay:  PaymentSheetApplePay(
            merchantCountryCode: 'FR',
          ),
    googlePay:  PaymentSheetGooglePay(
            merchantCountryCode: 'FR', currencyCode: 'EUR'),
    style: ThemeMode.system,
    merchantDisplayName: '128 Avenue',
    paymentIntentClientSecret: paymentIntent['client_secret'],
  ));
 await Stripe.instance.presentPaymentSheet();

Any error is displayed

package version : ^4.0.0

YoucefSFPlus avatar Aug 20 '22 18:08 YoucefSFPlus

Could you provide more information about:

  1. Are you using test or live environment? Same environment for both server and mobile
  2. Are you running a simulator or a real device? Does the simulator have google services?
  3. If in test mode, you should set: PaymentSheetGooglePay(merchantCountryCode: 'FR', currencyCode: 'EUR', testEnv: true),

I just tried last version on my device and works as expected:

IMAGE 2022-08-21 20:38:50

jamesblasco avatar Aug 21 '22 18:08 jamesblasco

@YoucefSFPlus : Make sure Google Pay is available in your device because if Gpay is not installed in your device it won't show.

ShwetaChauhan18 avatar Aug 26 '22 09:08 ShwetaChauhan18

@jamesblasco I tried in test and live mode in a real device, the environment is the same for server and mobile. When I used the test mode I correctly added testEnv: true but the Google Pay button still not showing up. @ShwetaChauhan18 my Gpay is enabled on my device and I implemented exactly the same code in another app and every thing works good but this time it doesn't work.

YoucefSFPlus avatar Sep 05 '22 12:09 YoucefSFPlus

Hi @jamesblasco @ShwetaChauhan18 , I forgot to add this line on my AndroidManifest <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" /> that's why the Gpay button was not showing.

Now it worked perfectly, thank you for your help !

YoucefSFPlus avatar Sep 05 '22 16:09 YoucefSFPlus