userCanPay static method

Future<bool> userCanPay(
  1. PayProvider provider,
  2. String merchantId
)

Checks if the user can make payments using Apple Pay (iOS) or Google Pay (Android).

  • provider: The payment provider (PayProvider.applePay or PayProvider.googlePay).
  • merchantId: The unique identifier for the merchant.
  • Returns: A Future<bool> indicating whether the payment method is supported.

Implementation

static Future<bool> userCanPay(
    PayProvider provider, String merchantId) async {
  if (Platform.isIOS && provider == PayProvider.applePay) {
    return await _channel
        .invokeMethod("isApplePaySupported", {"merchantId": merchantId});
  } else if (Platform.isAndroid && provider == PayProvider.googlePay) {
    return await _channel
        .invokeMethod("isGooglePaySupported", {"merchantId": merchantId});
  }
  return false;
}