                                     /// - 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
                                     }
                                 }
                             }

        }
    }
}

        }
        .navigationViewStyle(StackNavigationViewStyle())
        .colorScheme(.dark)
        .alert(
            isPresented: self.$displayError,
            error: self.error,
            actions: { _ in
                Button(role: .cancel,
                       action: { self.displayError = false },
                       label: { Text("OK") })
            },
            message: { Text($0.recoverySuggestion ?? "Please try again") }
        )
    }
}

