applePayResult method

  1. @override
Future<TapPaySdkCommonResult?> applePayResult({
  1. required bool result,
})
override

Report Apple Pay result

When you send the prime to your server and get the result, you can report the result to TapPay.

result is the result of the transaction.

return TapPaySdkCommonResult with value success as true if success. return TapPaySdkCommonResult with value success as false if fail. return TapPaySdkCommonResult with value message as String if fail.

Implementation

@override
Future<TapPaySdkCommonResult?> applePayResult({required bool result}) async {
  if (Platform.isIOS == false) {
    return TapPaySdkCommonResult(
        success: false,
        message: "Apple Pay is only available on iOS devices.");
  }

  final applePayResult = await methodChannel
      .invokeMethod<Map<Object?, Object?>>('applePayResult', {
    'result': result,
  });

  if (applePayResult == null) {
    return TapPaySdkCommonResult(
        success: false,
        message:
            "Encountered an unidentified error while requesting Apple Pay.");
  } else {
    return TapPaySdkCommonResult.fromMap(
        Map<String, dynamic>.from(applePayResult));
  }
}