flutter-stripe / flutter_stripe

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

Unable to see Gpay option in payment sheet #1844

Closed atulproject99 closed 4 months ago

atulproject99 commented 4 months ago

Describe the bug I configured like this but gpay not showing so how can test it?

try { await Stripe.instance.initPaymentSheet( paymentSheetParameters: SetupPaymentSheetParameters( merchantDisplayName: 'AdRent', paymentIntentClientSecret: clientSecret, primaryButtonLabel: 'Pay now', style: ThemeMode.light, //customFlow: Platform.isIOS ? false : true, applePay: const PaymentSheetApplePay( merchantCountryCode: 'GB', buttonType: PlatformButtonType.pay), googlePay: const PaymentSheetGooglePay( merchantCountryCode: 'GB', testEnv: false, currencyCode: 'GBP'), appearance: PaymentSheetAppearance( colors: PaymentSheetAppearanceColors( background: AppColors.baseColor, primary: AppColors.blueColor, icon: AppColors.blueColor, componentDivider: AppColors.greyColor, componentBackground: AppColors.baseColor, componentText: AppColors.blackTextColor, primaryText: AppColors.blackColor, placeholderText: AppColors.greyColor, secondaryText: AppColors.blackColor, componentBorder: AppColors.blackColor, ), shapes: const PaymentSheetShape( borderWidth: 4, shadow: PaymentSheetShadowParams(color: AppColors.blackColor), ), primaryButton: PaymentSheetPrimaryButtonAppearance( shapes: const PaymentSheetPrimaryButtonShape(blurRadius: 8), colors: PaymentSheetPrimaryButtonTheme( light: PaymentSheetPrimaryButtonThemeColors( background: AppColors.blueColor, text: AppColors.whiteTextColor, border: AppColors.transparentColor, ), dark: PaymentSheetPrimaryButtonThemeColors( background: AppColors.blueColor, text: AppColors.whiteTextColor, border: AppColors.transparentColor, ), ), ), ), // billingDetails: billingDetails, ), );

  await presentPaymentSheet(context);
} catch (e) {
  debugPrint('error => ${e.toString()}');
  state = SuccessResponseState.error(e.toString());
}

}

remonh87 commented 4 months ago

your phone needs to support google pay + you need to have a card coupled to your account else it will not display.

ohdonpiano commented 4 months ago

I have the same issue

1) I use GPay every day, I got the card in the Wallet

2) configured googlePay section like this:

googlePay: PaymentSheetGooglePay( merchantCountryCode: 'IT', currencyCode: 'EUR', label: "PianoLink", testEnv: true, amount: "12")

but no gpay button is shown in the payment sheet. Apple Pay instead is working file with its black button.

Are we missing some manifest or gradle configuration?

remonh87 commented 4 months ago

I would recommend to check the instructions here: https://docs.page/flutter-stripe/flutter_stripe/google_pay. I am able to see the button in the example app

atulproject99 commented 4 months ago

@remonh87 in india stripe elment not supported google pay so is there any way to test it ?

remonh87 commented 4 months ago

@atulproject99 I would contact Stripe for this because this is out of our hands. Will close ticket for now

nayanbabariya commented 4 months ago

@remonh87 I am also not able to see the GPay button in the stripe payment sheet. however, calling the below snippet shows me true in Android.

Stripe.instance
        .isPlatformPaySupported(
      googlePay: const IsGooglePaySupportedParams(testEnv: true),
    )
        .then((value) {
      print('Platform pay supported=============> $value');
    });

If I am using the Pay plugin and configuring the GooglePayButton, it is working. it shows the GPay payment bottom sheet when tapping on the Google Pay button. So my doubt is why flutter_stripe is not able to show the GPay button on stripe sheet itself?

remonh87 commented 4 months ago

You need to have a valid credit card configured as well on the phone. isGooglePaySupported just tells you that in the stripe configuration google pay is supported. I would recommend going through the stripe official docs: https://docs.stripe.com/google-pay?platform=react-native

nayanbabariya commented 4 months ago

@remonh87 I went through it, If I am using PlatformPayButton then it is working fine and opening the payment sheet. but the stripe payment sheet is not able to show the GPay button.

This is the Flutter-Stripe guide to follow. correct? https://docs.page/flutter-stripe/flutter_stripe/sheet#7-optional---enable-google-pay-only-android

I've double checked everything as per above link but still, It is not working.