 
 extension AuthorizingPaymentViewController: WKUIDelegate {
     public func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
-        delegate?.authorizingPaymentViewController?(self, runJavaScriptAlertPanelWithMessage: message, initiatedByFrame: frame, completionHandler: completionHandler)
-        if delegate == nil {
-            os_log("Run JavaScript alert panel with message but no delegate to be notified", log: uiLogObject, type: .default)
+
+        let alertController = UIAlertController(title: nil, message: message, preferredStyle: .alert)
+        let okAction = UIAlertAction(title: okButtonTitle, style: .default) { (action: UIAlertAction) -> Void in
+            alertController.dismiss(animated: true, completion: nil)
             completionHandler()
         }
+        
+        alertController.addAction(okAction)
+        
+        // NOTE: Must present an UIAlertController on AuthorizingPaymentViewController
+        self.present(alertController, animated: true)
     }
     
     public func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) {
-        delegate?.authorizingPaymentViewController?(self, runJavaScriptConfirmPanelWithMessage: message, initiatedByFrame: frame, completionHandler: completionHandler)
-        if delegate == nil {
-            os_log("Run JavaScript confirm panel with message but no delegate to be notified", log: uiLogObject, type: .default)
+                
+        let alertController = UIAlertController(title: nil, message: message, preferredStyle: .alert)
+        let confirmAction = UIAlertAction(title: confirmButtonTitle, style: .default, handler: { (action) in
+            completionHandler(true)
+        })
+        let cancelAction = UIAlertAction(title: cancelButtonTitle, style: .cancel, handler: { (action) in
             completionHandler(false)
-        }
-    }
-    
-    public func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) {
-        delegate?.authorizingPaymentViewController?(self, runJavaScriptTextInputPanelWithPrompt: prompt, defaultText: defaultText, initiatedByFrame: frame, completionHandler: completionHandler)
-        if delegate == nil {
-            os_log("Run JavaScript text input panel with prompt but no delegate to be notified", log: uiLogObject, type: .default)
+        })
+        
+        alertController.addAction(confirmAction)
+        alertController.addAction(cancelAction)
+
+        // NOTE: Must present an UIAlertController on AuthorizingPaymentViewController
+        self.present(alertController, animated: true, completion: nil)
+    }
+    
+    public func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) {        
+        let alertController = UIAlertController(title: nil, message: prompt, preferredStyle: .alert)
+        alertController.addTextField { (textField) in
+            textField.text = defaultText
+        }
+        let okAction = UIAlertAction(title: okButtonTitle, style: .default, handler: { (action) in
+            if let text = alertController.textFields?.first?.text {
+                completionHandler(text)
+            } else {
+                completionHandler(defaultText)
+            }
+        })
+        let cancelAction = UIAlertAction(title: cancelButtonTitle, style: .cancel, handler: { (action) in
             completionHandler(nil)
-        }
-    }
-}
-
+        })
+        
+        alertController.addAction(okAction)
+        alertController.addAction(cancelAction)
+        
+        // NOTE: Must present an UIAlertController on AuthorizingPaymentViewController
+        self.present(alertController, animated: true, completion: nil)
+    }
+}
+

    public weak var delegate: AuthorizingPaymentViewControllerDelegate?
    
    let webView: WKWebView = WKWebView(frame: CGRect.zero, configuration: WKWebViewConfiguration())
    
    
    /// A factory method for creating a authorizing payment view controller comes in UINavigationController stack.
    ///

    
    /// A delegation method called when user cancel the authorizing payment process.
    func authorizingPaymentViewControllerDidCancel(_ viewController: AuthorizingPaymentViewController)
    
    @available(*, unavailable,
    renamed: "authorizingPaymentViewController(_:didCompleteAuthorizingPaymentWithRedirectedURL:)")
