isPlatformPaySupported method

Future<bool> isPlatformPaySupported({
  1. IsGooglePaySupportedParams? googlePay,
  2. PlatformPayWebPaymentRequestCreateOptions? webPaymentRequestCreateOptions,
})

Check if the relevant native wallet (Apple Pay on iOS and Google Pay on Android) is supported.

The googlePay param can be provided to check if platform pay is supported on Google Pay test env or if a payment method is required. The webPaymentRequestCreateOptions param can be provided to confirm what if any platform pay options are available on web.

Implementation

Future<bool> isPlatformPaySupported({
  IsGooglePaySupportedParams? googlePay,
  PlatformPayWebPaymentRequestCreateOptions? webPaymentRequestCreateOptions,
}) async {
  await _awaitForSettings();
  final isSupported = await _platform.isPlatformPaySupported(
    params: googlePay,
    paymentRequestOptions: webPaymentRequestCreateOptions,
  );

  _isPlatformPaySupported ??= ValueNotifier(false);
  _isPlatformPaySupported?.value = isSupported;
  return isSupported;
}