                                     /// - If the user didn't cancel and there wasn't an error with the purchase, close the paywall
                                     if !userCancelled, error == nil {
                                         isPresented = false
+                                    } else if let error = error {
+                                        self.error = error as NSError
+                                        self.displayError = true
                                     }
                                 }
                             }

        }
    }
}

    
    private let footerText = "Don't forget to add your subscription terms and conditions. Read more about this here: https://www.revenuecat.com/blog/schedule-2-section-3-8-b"
    
    @State private var error: NSError?
    @State private var displayError: Bool = false

    var body: some View {
        NavigationView {
            ZStack {
