flutter-plugin
flutter-plugin copied to clipboard
Google Play button not visible
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 ]
How does your UI code look like?
@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,
);
},
@JlUgia please help with this issue asap.
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)
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.
As shown in the image above, this is how the UI appears; childOnError is executed.
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.
my code is exactly like yours @HaardikBhagtani. any solution on this
my code is exactly like yours @HaardikBhagtani. any solution on this
No, haven't found any solution.
@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 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
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
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?
i'm having the same problem, did u find a solution for this ?
i'm having the same problem, did u find a solution for this ?
No, not yet. @kldawad-wecan
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)

@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).
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.
i'm having the same problem, did anyone find a solution for this ?
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?
Hello, I have the same problem. How did you solve it
i'm having the same problem, did anyone find a solution for this ?
Hello, I have the same problem. How did you solve it
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.
Same problem here, any solution
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).
@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?
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
@JlUgia plz help what can i do to that
That's right @AgungLaksana, Apple Pay is only supported on iOS, and Google Pay is only supported on Android at the time.
Hi @Ridwan093, can you verify that the requirements to use Google Pay are met in the device that you are using to test?