diff --git a/pay_ios/ios/Classes/PaymentHandler.swift b/pay_ios/ios/Classes/PaymentHandler.swift index 887aadf..80d9362 100644 --- a/pay_ios/ios/Classes/PaymentHandler.swift +++ b/pay_ios/ios/Classes/PaymentHandler.swift @@ -194,17 +194,13 @@ extension PaymentHandler: PKPaymentAuthorizationControllerDelegate { } func paymentAuthorizationControllerDidFinish(_ controller: PKPaymentAuthorizationController) { - controller.dismiss { - DispatchQueue.main.async { - // There was no attempt to authorize. - if self.paymentHandlerStatus == .presented { - self.paymentResult(FlutterError(code: "paymentCanceled", message: "User canceled payment authorization", details: nil)) - } - // Authorization started, but it did not succeed - if self.paymentHandlerStatus == .authorizationStarted { - self.paymentResult(FlutterError(code: "paymentFailed", message: "Failed to complete the payment", details: nil)) - } - } + controller.dismiss() + // There was no attempt to authorize. + if self.paymentHandlerStatus == .presented { + self.paymentResult(FlutterError(code: "paymentCanceled", message: "User canceled payment authorization", details: nil)) + } + // Authorization started, but it did not succeed + if self.paymentHandlerStatus == .authorizationStarted { + self.paymentResult(FlutterError(code: "paymentFailed", message: "Failed to complete the payment", details: nil)) } - } }