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 Play button not visible #125

Open
HaardikBhagtani opened this issue Apr 18, 2022 · 30 comments
Open

Google Play button not visible #125

HaardikBhagtani opened this issue Apr 18, 2022 · 30 comments

Comments

@HaardikBhagtani
Copy link

this error seems to be coming in adb logcat and Google Pay button not visible instead childOnError triggered.

04-01 02:23:13.308 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.308 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:13.375 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.376 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:13.400 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.400 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:13.409 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:13.409 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:39.243 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]
04-01 02:23:39.243 3020 15516 I TapAndPay: Disabling TapAndPay HCE service [CONTEXT service_id=79 ]
04-01 02:23:39.267 3020 15516 W TapAndPay: shouldEnableGooglePay: false [CONTEXT service_id=79 ]

@JlUgia
Copy link
Member

JlUgia commented Apr 21, 2022

How does your UI code look like?

@HaardikBhagtani
Copy link
Author

@JlUgia
This is the UI code

                       GooglePayButton(
                        paymentConfigurationAsset: 'gpay.json',
                        paymentItems: [
                          PaymentItem(
                            label: 'Pay',
                            amount: newPlanCost,
                            status: PaymentItemStatus.final_price,
                          )
                        ],
                        width: 200,
                        height: 50,
                        style: GooglePayButtonStyle.black,
                        type: GooglePayButtonType.pay,
                        margin: const EdgeInsets.only(top: 15.0),
                        onPaymentResult: (paymentResult) {
                          print(paymentResult);
                          voucherCheckoutHandler(
                            paymentCheckout.newPlanName,
                            paymentCheckout.newPlanDealAmount,
                            uid,
                          );
                        },

@HaardikBhagtani
Copy link
Author

@JlUgia please help with this issue asap.

@JlUgia
Copy link
Member

JlUgia commented Jun 1, 2022

Can you share the error that you are receiving?
You can capture the error details adding the onError property to your GooglePayButton widget. (see https://github.com/google-pay/flutter-plugin/blob/main/pay/lib/src/widgets/pay_button.dart#L40)

@HaardikBhagtani
Copy link
Author

This is the code I used.

                       GooglePayButton(
                        paymentConfigurationAsset: 'gpay.json',
                        paymentItems: [
                          PaymentItem(
                            label: 'Pay',
                            amount: newPlanCost!,
                            status: PaymentItemStatus.final_price,
                          )
                        ],
                        width: 200,
                        height: 50,
                        style: GooglePayButtonStyle.black,
                        type: GooglePayButtonType.pay,
                        margin: const EdgeInsets.only(top: 15.0),
                        onPaymentResult: (paymentResult) {
                          print(paymentResult);
                          voucherCheckoutHandler(
                            paymentCheckout.newPlanName!,
                            paymentCheckout.newPlanDealAmount,
                            uid,
                          );
                        },
                        onError: (error) {
                          print(error);
                        },
                        childOnError: Text('Error'),
                        loadingIndicator: const Center(
                          child: CircularProgressIndicator(),
                        ),
                      ),

Added onError, but it didn't print anything on the console.
onError is not executed.

a0e992b2-629b-481f-a96f-8d581f547b5b

As shown in the image above, this is how the UI appears; childOnError is executed.

@kalliattShibin
Copy link

same issue here also. But onError is printing package:pay_platform_interface/core/payment_configuration.dart': Failed assertion: line 55 pos 16: 'configuration.containsKey('provider')': is not true.

@kalliattShibin
Copy link

my code is exactly like yours @HaardikBhagtani. any solution on this

@HaardikBhagtani
Copy link
Author

my code is exactly like yours @HaardikBhagtani. any solution on this

No, haven't found any solution.

@panchalAlpit
Copy link

panchalAlpit commented Jul 1, 2022

@HaardikBhagtani Please set the static height and width in Googlepaybutton.

       `SizedBox(
                width: Get.width*0.5,
                height: 50,
                child: GooglePayButton(
                  type: GooglePayButtonType.standard,
                onTap: (){},
              ),
            ),`

@HaardikBhagtani
Copy link
Author

@HaardikBhagtani Please set the static height and width in Googlepaybutton.

       `SizedBox(
                width: Get.width*0.5,
                height: 50,
                child: GooglePayButton(
                  type: GooglePayButtonType.standard,
                onTap: (){},
              ),
            ),`

no, it didn't work. @panchalAlpit

@kennest
Copy link

kennest commented Jul 28, 2022

Google Pay is not available in all countries.Please take a look at this : https://support.google.com/pay/india/answer/9023773?hl=en-GB#zippy=%2Cpay-online-or-in-apps

@HaardikBhagtani
Copy link
Author

Google Pay is not available in all countries.Please take a look at this : https://support.google.com/pay/india/answer/9023773?hl=en-GB#zippy=%2Cpay-online-or-in-apps

@kennest The link says that Google Pay is available in India, and it is where I am building the app, so why is the issue coming up?

@kldawad-wecan
Copy link

i'm having the same problem, did u find a solution for this ?

@HaardikBhagtani
Copy link
Author

i'm having the same problem, did u find a solution for this ?

No, not yet. @kldawad-wecan

@teoprayoga
Copy link

same problem, apple button and other options to pay showing error failed to open the config json file on real device

case:
i tried clone example app, then i just change value assets/default_payment_profile_apple_pay.json => merchantIdentifier and then run the app on real device. showing error "fopen failed for data file: errno = 2 (No such file or directory)

Screen Shot 2022-08-05 at 09 40 08

@JlUgia
Copy link
Member

JlUgia commented Aug 17, 2022

@codendtech in your case, the error is pointing to your configuration, which is missing the provider key. Take a look at the configuration in the example application as a reference.

@HaardikBhagtani @kldawad-wecan @teoprayoga, can you share the configuration you are using? (make sure to remove any secret value before doing so).

@amn-rwt
Copy link

amn-rwt commented Aug 29, 2022

I'm facing the same issue. The code doesn't throw any error and the GooglePayButton and ApplePayButton are being shown in WidgetInspector but not in the UI. I have tried wrapping the button inside sizedBox also and checked all configs for the plugin.

@mdzihad89
Copy link

i'm having the same problem, did anyone find a solution for this ?

@iUnknownWs
Copy link

iUnknownWs commented Dec 26, 2022

I think this is also happening to me, but i found that its only happens on emulator with API 30 and my phone, i tested on a emulator with API 31 and 33 and the button show up. Any solution yet?

@Edion-Liu
Copy link

Hello, I have the same problem. How did you solve it

@Edion-Liu
Copy link

i'm having the same problem, did anyone find a solution for this ?

Hello, I have the same problem. How did you solve it

@JlUgia
Copy link
Member

JlUgia commented Jul 31, 2023

The button is only shown if the userCanPay call returns true. That is, if the device and user can use Google Pay. Note that Google Play services needs to be installed on the device, and you need to be logged in with a valid account.
See #207 for additional context.

@darul9061
Copy link

Same problem here, any solution

@JlUgia
Copy link
Member

JlUgia commented Jan 20, 2024

As mentioned above, there are multiple reasons why the Google Pay button does not show if you use the quick integration path. To test the integration make sure that:

  • You are operating in the TEST environment (check your configuration JSON).
  • You have a device with a recent version of Google Play services installed and a valid gmail/Google apps account set up in the device (more details).
  • Your payment configuration is valid

If you still don't see the Google Pay button, add a comment to this thread including the code that draws your button and your payment configuration JSON (redacting sensitive information before posting).

@AgungLaksana
Copy link

AgungLaksana commented Mar 5, 2024

@JlUgia can I show Google Pay Button on iOS device? the Google Pay button only show on Android device. so I assume it won't be available for iOS right?

@Ridwan093
Copy link

hell

Same problem here, any solution

i have the same problem also any solution with this , my code only showing on emulator , was not showing on real device, my location was nigeria please help

@Ridwan093
Copy link

@JlUgia plz help what can i do to that

@JlUgia
Copy link
Member

JlUgia commented May 9, 2024

That's right @AgungLaksana, Apple Pay is only supported on iOS, and Google Pay is only supported on Android at the time.

@JlUgia
Copy link
Member

JlUgia commented May 9, 2024

Hi @Ridwan093, can you verify that the requirements to use Google Pay are met in the device that you are using to test?

@tanviranwarrafi
Copy link

tanviranwarrafi commented Sep 17, 2024

@HaardikBhagtani change your region from your device. I think you can try to change your region from your country to United States for testing purpose. As I am from Bangladesh and I also face the same issue because Apple pay and Google pay have no support for Bangladesh. So, try in this way I think you can see the magic.

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

No branches or pull requests