Closed rahul-raj07 closed 2 years ago
Got the same issue, followed the docs and everything compiles successfully. However when I comment out the isGooglePayAvailable() my app crashes. When I uncomment the isGooglePayAvailable() the console says "Not implemented" like in your case. I am also using capacitor 3.6.0. A colleague has the same code as me but on capacitor 2.6.4 and everything works fine, however I cannot change the capacitor versions for obvious reasons
This is console after I comment out the isGooglePayAvailable() => No Error, but App crashes
This is console after I add the isGooglePayAvailable() => Error, but App doesn't crash
The function I use on click button
@rahul-raj07 @nxj1129 Please try this code:
const isAvailable = Stripe.isGooglePayAvailable().then(() => true).catch(() => false);
isGooglePayAvailable
method is return void(or error).
This is how it is used in the demo.: https://github.com/capacitor-community/stripe/blob/master/demo/angular/src/app/tab1/tab1.page.ts#L135
@rdlabo I tried this code also, but I get the same error unfortunately
@rahul-raj07 @nxj1129
In android device(android app)、 isGooglePayAvailable
is checked here:
https://github.com/capacitor-community/stripe/blob/master/android/src/main/java/com/getcapacitor/community/stripe/StripePlugin.java#L64
If always false, you may not have enough settings. This demo's url will help you: https://github.com/capacitor-community/stripe/blob/master/demo/angular/android/app/src/main/AndroidManifest.xml#L37-L39 https://github.com/capacitor-community/stripe/blob/master/demo/angular/android/app/src/main/res/values/strings.xml#L8-L12
Thanks.
@rahul-raj07 @nxj1129 have u found a solution fo that issue ??
This Issue is closed because there are no updates. If there are any updates, please start a new Issue. Thank you.
Got the same issue, followed the docs and everything compiles successfully. However when I comment out the isGooglePayAvailable() my app crashes. When I uncomment the isGooglePayAvailable() the console says "Not implemented" like in your case. I am also using capacitor 3.6.0. A colleague has the same code as me but on capacitor 2.6.4 and everything works fine, however I cannot change the capacitor versions for obvious reasons
This is console after I comment out the isGooglePayAvailable() => No Error, but App crashes
This is console after I add the isGooglePayAvailable() => Error, but App doesn't crash
The function I use on click button
Same issue.. any fix?
Description of the bug: isGooglePayAvailable method returns "Not implemented on device" and presentGooglePay method does not show any paymentResult promise being logged in the console window even though the paymentIntent is being sent. Rather the app crashes, and I'm returned to the home screen of my android device. Also, after the app crashes, I'm getting a message being logged in the logcat section of Android Studio that says :
To Reproduce: I am trying to implement GooglePay integration in an ionic + react + capacitor mobile application. I have installed and run capacitor-community/stripe plugin using following commands :
And then I used “CapacitorStripeProvider” to initialize the plugin like so:
And then, I followed the official docs of capacitor-community/stripe to implement the Google Pay functionality. I did everything mentioned there. Called different methods such as isGooglePayAvailable, createGooglePayAvailable and presentGooglePayAvailable.
There are several issues that I’m facing after running the code for GooglePay Integration:
On certain android devices, I’m getting a message that says “Not implemented on device” being logged in the console window from the isGooglePayAvailable method even though I have Gpay app installed and logged in in my android device. On other devices, isGooglePayAvailable methods executes successfully and returns resolve: void response.
Also, after having called presentGooglePay method, my android app crashes and I am returned to the home screen of my android device. Also, I am getting native Stripe.presentGooglePay being logged in the console window but I’m not able to see any “result Stripe.presentGooglePay” in the console window.
Also, I’m getting an error in the logcat of Android Studio that says: Caused by: java.lang.IllegalStateException: presentForPaymentIntent() may only be called when Google Pay is available on this device.
I know all of this must have been quite confusing and cryptic as well to comprehend. So, it would be better if any one could provide me his/her contact details (an email id or anything as such would do), so that I could better make my points clear and share screen to show the code that I’ve used and the errors that I’m getting.
Here's the screenshot of the console messages and errors that I'm getting in the console window.
After clicking the create button createGooglePay method is called and here's the screenshot of the console window that I'm getting:
After clicking on the present button, presentGooglePay method is called and here's the screenshot of the console window:
Here's the code that I've used for GooglePay integration.
Here's the code that I've used to get the paymentIntent from the usePaymentSheet hook:
My package.json file:
My capacitor config ---> capacitor.config.json:
Thanks, Rahul