flutter_stripe payment sheet not showing google pay button in mobile

Viewed 258

Apple pay button is showing in ios device but google pay button is not showing in both the devices.

Here is my initPaymentSheet method

await Stripe.instance.initPaymentSheet(
  paymentSheetParameters: SetupPaymentSheetParameters(
  applePay: true,
  googlePay: true,
  testEnv: true,
  merchantCountryCode: 'IN',
  merchantDisplayName: 'DisplayName',
  customerId: paymentIntentData!['customer'],
  paymentIntentClientSecret: paymentIntentData!['client_secret'],
  customerEphemeralKeySecret: paymentIntentData!['ephemeralKey'],
   ));

1 Answers

First Gpay App should be in your android device and second I think in iOS it will not support(2nd for iOS device I am not sure but till now in my implementation it's not working..)

Flutter version:

dependencies:
  flutter_stripe: ^4.0.0

You Payment sheet code should be like this in latest way:

await Stripe.instance.initPaymentSheet(
        paymentSheetParameters: SetupPaymentSheetParameters(
          // Main params
          paymentIntentClientSecret: data['paymentIntent'],
          merchantDisplayName: 'Flutter Stripe Store Demo',
          // Customer params
          customerId: data['customer'],
          customerEphemeralKeySecret: data['ephemeralKey'],
          // Extra params
          applePay: PaymentSheetApplePay(
            merchantCountryCode: 'DE',
          ),
          googlePay: PaymentSheetGooglePay(
            merchantCountryCode: 'DE',
            testEnv: true,
          ),
          style: ThemeMode.dark,
          appearance: PaymentSheetAppearance(
            colors: PaymentSheetAppearanceColors(
              background: Colors.lightBlue,
              primary: Colors.blue,
              componentBorder: Colors.red,
            ),
            shapes: PaymentSheetShape(
              borderWidth: 4,
              shadow: PaymentSheetShadowParams(color: Colors.red),
            ),
            primaryButton: PaymentSheetPrimaryButtonAppearance(
              shapes: PaymentSheetPrimaryButtonShape(blurRadius: 8),
              colors: PaymentSheetPrimaryButtonTheme(
                light: PaymentSheetPrimaryButtonThemeColors(
                  background: Color.fromARGB(255, 231, 235, 30),
                  text: Color.fromARGB(255, 235, 92, 30),
                  border: Color.fromARGB(255, 235, 92, 30),
                ),
              ),
            ),
          ),
          billingDetails: billingDetails,
        ),
      );
Related