     // Return the result back to the channel
     self.paymentResult(String(decoding: paymentResultData, as: UTF8.self))
     
-    paymentStatus = .success
-    completion(PKPaymentAuthorizationResult(status: paymentStatus, errors: nil))
+    paymentHandlerStatus = .authorized
+
+    completion(PKPaymentAuthorizationResult(status: PKPaymentAuthorizationStatus.success, errors: nil))
   }
   
   func paymentAuthorizationControllerDidFinish(_ controller: PKPaymentAuthorizationController) {
     controller.dismiss {
       DispatchQueue.main.async {
-        if self.paymentStatus != .success {
+        // 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))
         }
       }

/// An alias to determine the result types of a payment operation.
typealias PaymentCompletionHandler = (Bool) -> Void

/// A simple helper to orchestrate fundamental calls to complete a payment operation.
///
/// Use this class to manage payment sessions, with the ability to determine whether a user


/// Extension that implements the completion methods in the delegate to respond to user selection.
extension PaymentHandler: PKPaymentAuthorizationControllerDelegate {

  func paymentAuthorizationControllerWillAuthorizePayment(_ controller: PKPaymentAuthorizationController) {
      paymentHandlerStatus = .authorizationStarted
  }
    
  func paymentAuthorizationController(_: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) {
    
    // Collect payment result or error and return if no payment was selected
