stripe icon indicating copy to clipboard operation
stripe copied to clipboard

Google Pay not working in ionic capacitor app

Open adeel399 opened this issue 1 year ago • 5 comments

Platform

  • [ ] Web
  • [ ] iOS
  • [ x] Android

Describe the bug i am using ionic capacitor and want to integrate google pay using that plugin but as i click button to present google pay screen blinks and nothing happen no dialog for google pay form. //variable.gradle ext { minSdkVersion = 26 compileSdkVersion = 34 targetSdkVersion = 33 androidxActivityVersion = '1.2.0' androidxAppCompatVersion = '1.2.0' androidxCoordinatorLayoutVersion = '1.1.0' androidxCoreVersion = '1.3.2' androidxFragmentVersion = '1.3.0' junitVersion = '4.13.1' androidxJunitVersion = '1.1.2' androidxEspressoCoreVersion = '3.3.0' cordovaAndroidVersion = '7.0.0' stripeAndroidVersion = '20.41.0' }

//below is buttons code

async createGooglePay() {

await Stripe.createGooglePay({
  paymentIntentClientSecret: "some payemnt intent",
  paymentSummaryItems: [
    {
      label: 'Product Name',
      amount: 1099.0,
    },
  ],
  merchantIdentifier: 'merchant.com.getcapacitor.stripe',
  countryCode: 'US',
  currency: 'USD',
});

}

async presentGooglePay() { return Stripe.presentGooglePay(); }

To Reproduce

Expected behavior it should display google pay form

Screenshots WhatsApp Image 2024-04-22 at 16 27 50_0eb3575b

Additional context Add any other context about the problem here.

Usage Product If you adopt this plugin, please let us know which product you are using.

Product Name: Product URL : Using Function:

  • [x] Payment Sheet / Payment Flow
  • [ ] Apple Pay
  • [x] Google Pay
  • [ ] Identity (@capacitor-community/stripe-identity)
  • [ ] Terminal(@capacitor-community/stripe-terminal)

adeel399 avatar Apr 22 '24 11:04 adeel399

please let me know if i am doing wrong somthing

adeel399 avatar Apr 22 '24 11:04 adeel399

@rdlabo anyone please help

adeel399 avatar Apr 23 '24 11:04 adeel399

I came to know that it look like google pay luncher issue that blink but does not show on screen ,any fix

adeel399 avatar Apr 23 '24 13:04 adeel399

Sorry for the delay, most likely the settings in strings.xml and AndroidManifest.xml are wrong. Or you don't have Google Pay configured on your device.

First, check availability with Stripe.isGooglePayAvailable(). Documentation can be found here. https://stripe.capacitorjs.jp/docs/google-pay

rdlabo avatar Aug 11 '24 02:08 rdlabo

I encountered the problem that Stripe.isGooglePayAvailable() always gives an error. When debugging, I found that this block of code in the capacitor-community-stripe plugin: class MetaData(protected var contextSupplier: Supplier<Context>) { ....

            val appInfo = contextSupplier
                .get() // => it always is null so other variable setting is skipped. e.g enableGooglePay
                .packageManager
                .getApplicationInfo(contextSupplier.get().packageName, PackageManager.GET_META_DATA)

            enableGooglePay =
                appInfo.metaData.getBoolean("com.getcapacitor.community.stripe.enable_google_pay")
....

My AndroidManifest.xml image

My android emulator device already setup Google Pay. It works with OloPaySDK.

lebaphi avatar Dec 18 '24 13:12 lebaphi

This is returning the result from Stripe’s GooglePayLauncher, so it’s not an issue on the plugin side.

All the necessary values are already provided here: https://github.com/capacitor-community/stripe/blob/main/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/StripePlugin.kt#L68-L90

The only way to proceed is to check whether the intended values are correctly set in the metaData.

rdlabo avatar Nov 20 '25 06:11 rdlabo