flutter-stripe / flutter_stripe

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

Flutter Stripe Payment Sheet Google Pay Not Showing Android #1296

Closed MuhammadMusa22 closed 1 year ago

MuhammadMusa22 commented 1 year ago

Describe the bug I have integrated Stripe into flutter app, using flutter_stripe: ^7.0.0, every thing works fine when showing payment sheet for getting transaction from cards. Now I want to add Google Pay and Apple Pay as well, i have configured all things according to docs, but in Google pay case, in one of my mobile, Poco X3 NFC, Google pay button is showing, but in other mobiles Google pay button is not showing in flutter payment sheet. I have even logged-in the same google account from Poco x3 where google pay button was visible in other devices where google pay button is not visible, but still the problem is there.

Note: I am integrating these features in one of the app that is only available in Norway, mean Google Pay does have support there but i am doing my development in Pakistan where Google pay services neither google pay is available. But my question is why Google pay is even showing on Poco X3 device. What is the problem i am facing.

Flutter doctor -v [✓] Flutter (Channel stable, 3.10.1, on macOS 12.6 21G115 darwin-arm64, locale en-PK) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.1)

To Reproduce Steps to reproduce the behavior:

  1. Open Stripe payment sheet in testing mode.

Expected behavior Google pay button should be there.

Smartphone / tablet

Code `PaymentSheetGooglePay googlePay = const PaymentSheetGooglePay( merchantCountryCode: 'NO', testEnv: true, currencyCode: 'NOK', );

PaymentSheetApplePay applePay = const PaymentSheetApplePay(
  merchantCountryCode: 'NO',
);
await Stripe.instance.initPaymentSheet(
  paymentSheetParameters: SetupPaymentSheetParameters(
    paymentIntentClientSecret: paymentIntentClientSecret,
    merchantDisplayName: 'ABC',
    style: ThemeMode.light,
    appearance: const PaymentSheetAppearance(
      colors: PaymentSheetAppearanceColors(primary: AppColors.primaryColor),
    ),
    googlePay: googlePay,
    applePay: applePay,
  ),
);
try {
  await Stripe.instance.presentPaymentSheet();
  emit(StripePaymentSuccessful(stripeIntentId: stipeIntentId));
} on StripeException catch (e) {
  if (e.error.code == FailureCode.Canceled) {
    emit(StripePaymentCancelled(message: e.error.message!));
  } else if (e.error.code == FailureCode.Failed) {
    emit(StripePaymentFailed(message: e.error.message!));
  } else {
    emit(StripePaymentFailed(message: e.error.message!));
  }
}

}`

remonh87 commented 1 year ago

did you configure google pay on the phone itself? I did test google pay on my phone and I am able to see it on the payment sheet. I do not know why Google pay is showing on the poco device probably the locale of the device is of a country where google pay is available? I would suggest contacting google or stripe support because this is outside our library. The paymentsheet is not under our control we barely show it.