I am using this Pay Flutter Package , and I use this code below to show Google Pay Button
GooglePayButton(
paymentConfiguration: PaymentConfiguration.fromJsonString(
defaultGooglePayConfigString),
paymentItems: _paymentItems,
type: GooglePayButtonType.buy,
margin: const EdgeInsets.only(top: 15.0),
onPaymentResult: onGooglePayResult,
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
)
but the button won't show on iOS devices, only on Android. as far I know I can run the code below to know whether the button can be shown or not
late final Pay _payClient;
_payClient = Pay(
{
PayProvider.google_pay: PaymentConfiguration.fromJsonString(defaultGooglePayPaymentConfiguration),
},
final canPay = await _payClient.userCanPay(PayProvider.google_pay);
When I run the code above on real iOS device, the canPay
will return false
.
my question is, is it possible the canPay
will be true
on iOS devices if certain condition has been met?
The pay
plugin is not specific to Google Pay. It supports Apple Pay on iOS and Google Pay on Android (see the platform support section in the docs).
As Ovidiu hints, Google Pay is not supported on iOS. Your requirements are only yours, but if you are looking for a platform-native payment facilitator, Apple Pay is certainly worth considering. The documentation includes an example with the ApplePayButton
.