checkAvailability function
Future<Map<String, bool> >
checkAvailability(
- Map<
String, dynamic> request, - SmartCheckoutEnvironment environment
Implementation
Future<Map<String, bool>> checkAvailability(
Map<String, dynamic> request,
SmartCheckoutEnvironment environment,
) async {
final result = {'applePay': false, 'googlePay': false};
try {
// Checks Apple Pay
if (Platform.isIOS) {
final applePayProvider = ApplePayProvider();
result['applePay'] = await applePayProvider.isApplePayAvailable(
request,
environment,
);
}
// Checks Google Pay
if (Platform.isAndroid) {
final googlePayProvider = GooglePayProvider();
result['googlePay'] = await googlePayProvider.isGooglePayAvailable(
request,
environment,
);
}
} catch (e) {
debugPrint('Error checking wallets: $e');
}
return result;
}