Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google pay integration using GooglePayLauncher #4102

Closed
shubhamrb opened this issue Aug 12, 2021 · 34 comments
Closed

Google pay integration using GooglePayLauncher #4102

shubhamrb opened this issue Aug 12, 2021 · 34 comments
Assignees
Projects

Comments

@shubhamrb
Copy link

shubhamrb commented Aug 12, 2021

Summary

onGooglePayReady always returns false.

Code to reproduce

final GooglePayLauncher googlePayLauncher = new GooglePayLauncher(
this,
new GooglePayLauncher.Config(
GooglePayEnvironment.Test,
"IN",
"Widget Store"
),
this::onGooglePayReady,
this::onGooglePayResult
);
private void onGooglePayReady(boolean isReady) {
// implemented below
binding.btnGPay.setEnabled(isReady);
}

Android version

Android version : 9

Impacted devices

Device : MI A1

Installation method

as per the stripe doc https://stripe.com/docs/google-pay

SDK version

SDK version : implementation 'com.stripe:stripe-android:17.1.0'

Other information

@michelleb-stripe
Copy link
Contributor

@shubhamrb I am sorry that onGooglePayReady is always returning false.

In order to test and use Google Pay on a phone you must have the Google Pay App installed, and a payment method added as described here.

Sometime users worry that during testing the payment method attached to their Google Pay account will be charged. If you set the GooglePay configuration to GooglePayEnvironment.Test as shown below, your card will NOT be charged.

        val googlePayLauncher = GooglePayLauncher(
            activity = this,
            config = GooglePayLauncher.Config(
                environment = GooglePayEnvironment.Test,
                merchantCountryCode = "US",
                merchantName = "Widget Store"
            ),
            readyCallback = ::onGooglePayReady,
            resultCallback = ::onGooglePayResult
        )

@shubhamrb
Copy link
Author

shubhamrb commented Aug 12, 2021

i've Google pay installed in my phone,

also i've added following lines in my manifest :

meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true"

still facing this issue

@michelleb-stripe
Copy link
Contributor

@shubhamrb Can you share the following values being set in the GooglePayLauncher.Config?

  • environment (GooglePayEnvironment) - Test or Production?
  • merchantCountryCode
  • isEmailRequired - True or False?
  • BillingAddressConfig
    • isRequired - True or False?
    • format - Min or Full?
    • isPhoneNumberRequired - True or False
  • existingPaymentMethodRequired - True or False?

@shubhamrb
Copy link
Author

shubhamrb commented Aug 12, 2021

this is in my GooglePayLauncher.Config

new GooglePayLauncher.Config(
                        GooglePayEnvironment.Test,
                        "IN",
                        "Widget Store",
                        false,
                        new GooglePayLauncher.BillingAddressConfig(
                                false, GooglePayLauncher.BillingAddressConfig.Format.Min,
                                true
                        ),true
                )


@shubhamrb
Copy link
Author

FYI i am using it inside Fragment.

@michelleb-stripe
Copy link
Contributor

@shubhamrb Google Pay is not available across all countries and devices. I am curious if you would be able to test it out on an emulator?

@shubhamrb
Copy link
Author

@michelleb-stripe can you please confirm if it is available in India?

and as you suggest for emulator, I will try but i guess in emulator Google pay app won't work

@michelleb-stripe
Copy link
Contributor

@shubhamrb I currently have PaymentSheet from the Stripe SDK working with Google Pay on my emulator, so you shouldn't have any trouble. Specifically I am using Android 10.0 (Google Play), I have also associated my Google account with the phone. I am happy to help if you have any trouble getting it set up.

Based on this page provided by google, I believe it should work in India.

@shubhamrb
Copy link
Author

@michelleb-stripe can you please help me with the pseudocose for paymentsheet integration, because i used it previously and it didn't work.

@michelleb-stripe
Copy link
Contributor

@shubhamrb Since you already have GooglePayLauncher configured and setup you can continue to use it. I have verified that GooglePayLauncher will also work on the emulator: Android 10.0 (Google Play).

@shubhamrb
Copy link
Author

@michelleb-stripe i tried in emulator also but it didn't work, i don't know i am doing something wrong

@michelleb-stripe
Copy link
Contributor

@shubhamrb I am continue to troubleshoot your issue.

When setting up my account on GooglePay I had to add a card on a real phone, and then use the same GooglePay account on the emulator. (This is because the GooglePay standalone could not be opened on the emulator to setup the card).

Could you share how you configured GooglePay for your account? Which type of card network you associated with your GooglePay account on the emulator. Was it one of these: "AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA"? Or did you connect Google Pay to your bank account and using the wallet functionality?

@shubhamrb
Copy link
Author

@michelleb-stripe i didn't have any card in my Google pay account, i have connected by bank account using registered mobile number.

@michelleb-stripe
Copy link
Contributor

@shubhamrb Google Pay lists the supported PaymentMethods here. As of today, they support a limited number of Cards or PayPal. Unfortunately a connected bank account is not supported.

Today the SDK works with a subset of what Google Pay supports. It should work with the following cards: "AMEX", "DISCOVER", "MASTERCARD", "VISA". It should work for pre-paid cards as well.

@shubhamrb
Copy link
Author

shubhamrb commented Aug 14, 2021

@michelleb-stripe that's really unfortunate and strange bcz most no. of user in India uses their bank account in GPay not cards.
anyways thanks for the help.
hope Stripe resolve it soon.

@michelleb-stripe
Copy link
Contributor

@shubhamrb Unfortunately we will not be able to resolve this issue until Google supports this in their API. We will keep watching for when they publish new support and add it when it becomes available.

@bridgingamit18
Copy link

bridgingamit18 commented Aug 18, 2021

Hello @michaelc-stripe

onGooglePayReady always returns false.
And My G-Pay Account "MASTERCARD" and "VISA" Card are both links but still always return false.
Can you please guide me?

googlePayLauncher = GooglePayLauncher(
activity = this,
config = GooglePayLauncher.Config(
environment = GooglePayEnvironment.Test,
merchantCountryCode = "US",
merchantName = "Widget Store"
),
readyCallback = ::onGooglePayReady,
resultCallback = ::onGooglePayResult
)

      private fun onGooglePayReady(isReady: Boolean) {
  
         btngooglePayButton.isEnabled = isReady
      }

private fun onGooglePayResult(
    result: GooglePayLauncher.Result
) {
    when (result) {
        is GooglePayLauncher.Result.Completed -> {
              }
        GooglePayLauncher.Result.Canceled -> {
          }
        is GooglePayLauncher.Result.Failed -> {
            }
    }
}

After instantiating GooglePayLauncher, the GooglePayLauncher.ReadyCallback instance is called with a flag indicating
whether Google Pay is available and ready to use. This flag can be used to update your UI to indicate to your
customer that Google Pay is ready to be used.

Always returns false.

@Qiubeijun
Copy link

Hello @michaelc-stripe

onGooglePayReady always returns false.
And My G-Pay Account "MASTERCARD" and "VISA" Card are both links but still always return false.
Can you please guide me?

googlePayLauncher = GooglePayLauncher(
activity = this,
config = GooglePayLauncher.Config(
environment = GooglePayEnvironment.Test,
merchantCountryCode = "US",
merchantName = "Widget Store"
),
readyCallback = ::onGooglePayReady,
resultCallback = ::onGooglePayResult
)

      private fun onGooglePayReady(isReady: Boolean) {
  
         btngooglePayButton.isEnabled = isReady
      }

private fun onGooglePayResult(
    result: GooglePayLauncher.Result
) {
    when (result) {
        is GooglePayLauncher.Result.Completed -> {
              }
        GooglePayLauncher.Result.Canceled -> {
          }
        is GooglePayLauncher.Result.Failed -> {
            }
    }
}

After instantiating GooglePayLauncher, the GooglePayLauncher.ReadyCallback instance is called with a flag indicating
whether Google Pay is available and ready to use. This flag can be used to update your UI to indicate to your
customer that Google Pay is ready to be used.

Always returns false.

I have the same problem, but I guess it might be because I don't have a payment card in my Google account (I can't add a payment card to my account), so I decided to let my customer test it out

@bridgingamit18
Copy link

Hello @michaelc-stripe and @Qiubeijun
In my G-Pay Account, I have added a payment card as well but still, I have received onGooglePayReady always returns false.

@bhomaramgtsinfo
Copy link

I think i got the issue

https://github.com/stripe/stripe-android/blob/master/payments-core/src/main/java/com/stripe/android/googlepaylauncher/GooglePayRepository.kt#L26-L53

In DefaultGooglePayRepository the value of existingPaymentMethodRequired is always true, the value is not taking from Config

@xiuone
Copy link

xiuone commented Oct 13, 2021

@michelleb-stripe hello , I have the same problem
and visa in my google play account
and
"com.google.android.gms:play-services-wallet:18.1.3"
""
is added
please help me ,I don't know do something

@xiuone
Copy link

xiuone commented Oct 13, 2021

@bridgingamit18 hello ,are you solve?

@bridgingamit18
Copy link

No @xiuone
I have shared the source code with the striped team.
During testing for my demo with the striped team it's working fine.
But my end is not working still.

@projects-mindiii
Copy link

getting Google Pay is available in device even installed in app along with added payment method. getting this issue in some devices.

@michelleb-stripe michelleb-stripe added this to To do in Tracking Nov 10, 2021
@michelleb-stripe michelleb-stripe moved this from To do to Backlog in Tracking Nov 10, 2021
@periva101
Copy link

any news?

@Vkalns
Copy link

Vkalns commented Feb 1, 2022

In order to test and use Google Pay on a phone you must have the Google Pay App installed, and a payment method added as described here.

I think this assumption might not be entirely correct.
In my scenario I have google account which uses Google provided Test Card suite. And if you are setting allowed auth methods to include PAN_ONLY, it should work WITHOUT actual Card saved in Google Pay app on phone. But when I test it on old emulator (API 23) I get onGooglePayReady returning value false. So it seems like PAN_ONLY auth method gets ignored?

onGooglePayReady returns true when real device is used which has the Google Pay app installed and card registered.

@Pulit
Copy link

Pulit commented Apr 13, 2022

any news here?

I have a same issue.

But, when I tested with a google wallet library not using stripe library, I can get a true value from ready callback listener.

I created a PaymentsClient directly with same Test Environment, and added cards listof (AMEX, DISCOVER, JCB, MASTERCARD, VISA), afterwards, I was able to get a true value.

Is it related with a Country Code?? It seems like It might affect list of available cards.

Please give me a clue for it

@dasprasky
Copy link

I am facing the same issue. I have tried it on multiple android devices but the ready callback is always false. I have also tried multiple merchant ids including: US, IN, HK - same result.

@Pulit
Copy link

Pulit commented Apr 25, 2022

We found the solution of the ready callback returning false.
Anyone who has trouble of ready callback always returns false,
Please check the sim-card's country code.
On our case, the google pay is only enabled with only sim-card of google pay available countries (such as JP).
The device with sim-card of google pay not available country (such as KR), ready callback always returns false.

@milanvadhel-mi
Copy link

I am still facing this issue. Any update on this?

@rajkumar-rpoli
Copy link

rajkumar-rpoli commented Jun 3, 2022

googlePayLauncher =
GooglePayLauncher(
fragment = this,
config = GooglePayLauncher.Config(
environment = GooglePayEnvironment.Test,
merchantCountryCode = "US",
merchantName = "Widget Store",
existingPaymentMethodRequired = false
),

            readyCallback = ::onGooglePayReady,
            resultCallback = ::onGooglePayResult
        )

pass existingPaymentMethodRequired = false it will work

@michelleb-stripe michelleb-stripe moved this from Big Backlog to Waiting on Asker in Tracking Jun 3, 2022
@michelleb-stripe michelleb-stripe moved this from Waiting on Asker to To do in Tracking Jun 3, 2022
@kaushal-prabhakar
Copy link

Yes existingPaymentMethodRequired = false, worked for me

@brnunes-stripe
Copy link
Contributor

brnunes-stripe commented Sep 28, 2022

Hello,

This issue has been open for a while, and it seems to have attracted people who are having problems with their Google Pay integration, but haven't opened a new issue.

One thing I noticed that might be casing confusion is the "Google Pay" branding. We support the Google Pay API, which lets you pay with credit or debit cards, or link a PayPal account.

This comment says:

i didn't have any card in my Google pay account, i have connected by bank account using registered mobile number.

That makes me think that some people might be referring to Google Pay for India, which lets you pay with your bank account through UPI. We don't support this integration yet.

If you're having problems integrating with Google Pay through our SDK, please open a new issue, and follow the instructions provided in the template so that we have enough information to help you. Please also let us know your country and what payment method you're trying to use, so we can better understand your situation.

@intelle-tech
Copy link

@brnunes-stripe

i am having issue with viewmodelscope in latest stripe sdk and kotlin sdks, view model, it says not found. and a crash is being thrown,
I cannot paste complete code as its complex logic. but i can explain scenerio, and can send you video also.

when user wants to pay via googlepay , payment launcher is launched, and app crash before receiving result.
i have shared crash reports below.

 implementation 'androidx.core:core-ktx:1.12.0'
implementation  'androidx.lifecycle:lifecycle-viewmodel:2.6.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
Screenshot 2023-12-08 at 6 18 26 PM Screenshot 2023-12-08 at 6 16 40 PM

android app crash report.

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/ViewModelKt;
at com.stripe.android.googlepaylauncher.GooglePayLauncherViewModel.onConfirmResult(GooglePayLauncherViewModel.kt:194)
at com.stripe.android.googlepaylauncher.GooglePayLauncherActivity$onActivityResult$1.invokeSuspend(GooglePayLauncherActivity.kt:133)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.kt:33)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:367)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
at com.stripe.android.googlepaylauncher.GooglePayLauncherActivity.onActivityResult(GooglePayLauncherActivity.kt:132)
at android.app.Activity.dispatchActivityResult(Activity.java:8923)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5592)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5638)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2437)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8294)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@e7ab49c, Dispatchers.Main.immediate]
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ViewModelKt" on path: DexPathList[[zip file "/data/app/~~JkXNn9s8WFKsiwF61iL7gA==/com.rydesk.user-61lpzxJVbBT6uOCQ5dyB-g==/base.apk"],nativeLibraryDirectories=[/data/app/~~JkXNn9s8WFKsiwF61iL7gA==/com.rydesk.user-61lpzxJVbBT6uOCQ5dyB-g==/lib/arm64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests