Problem with loading WKWebview with HTML String to load a BillDesk SDK in iOS Swift


I tried updating baseURL to Bundle.main.bundleURl or resourceURL still no luck
And i Have created Entitlements to Allow Outgoing connection still its not loading any page. It just shows a blank image. Can anyone help with with this with proper steps.

self.webView.navigationDelegate = self
self.webView.uiDelegate = self
self.webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true
self.webView.configuration.preferences.javaScriptEnabled = true
self.webView.configuration.preferences.isFraudulentWebsiteWarningEnabled = true
    
let htmlString = """
        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta http-equiv="content-type" content="text/html; charset=UTF-8">
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
            <meta name="description" content="">
            <meta name="author" content="">
            <link rel="icon" href="index_folder/favicon.ico">
            <title>Billdesk SDK</title>
        </head>
        <body onload="callBilldeskSdk()">
            <script type="module" src="https://pay.billdesk.com/jssdk/v1/dist/billdesksdk/billdesksdk.esm.js"></script>
            <script nomodule="" src="https://pay.billdesk.com/jssdk/v1/dist/billdesksdk.js"></script>
            <link href="https://pay.billdesk.com/jssdk/v1/dist/billdesksdk/billdesksdk.css" rel="stylesheet">
            <script type="text/javascript">
                function merchantCallback(txn) {
                    if (txn.txnResponse) {
                        const splitToken = txn.txnResponse.transaction_response.split('.');
                        let billDesk = JSON.parse(atob(splitToken[1]))
                        if (billDesk.auth_status === "0300") {
                            console.log("61imjo9773cg1f1exy8a " + txn.txnResponse.transaction_response + " " + txn.txnResponse.orderid)
                        } else if (billDesk.auth_status === "0002") {
                            console.log("y49l5bmga6w6n79iggya " + txn.txnResponse.transaction_response + " " + txn.txnResponse.orderid);
                        } else if (billDesk.auth_status === "0399") {
                            console.log("l7suwcehhq4znnrrtq6g " + txn.txnResponse.transaction_response + " " + txn.txnResponse.orderid);
                        }
                        // from here need to send the data for the success model
                    } else {
                        //this message is for when canceled by the user.
                        console.log("Your recent payment has been canceled")
                    }
                }
                function callBilldeskSdk(){
                    var flow_config = {
                        merchantId: "GARENTFK2",
                        bdOrderId: "OAS23RQJWUDD",
                        authToken: "OToken b0dec9736015c14239942b1da9e20b252296b598c319a5458a071a1f82f45c79f5247bd6e0b19b09bfc4780e330efecb56fae7d9525844589389263793b97e3952ddef7807dad8bdb9ddf3911a9491935ca1cec56e2a7e2e797fae28e6a75f53ed4973eb877a674f27d06c5ebe64d7064525b6397353b07c77a454c3320699c918648c80288b5eacb363eb6e42b30db45408e7a401aa9931c358acf59b859f70032e97aa6382.70675f706172616d5f656e6333",
                        childWindow: false,
                        retryCount: 3
                    }
                    var config = {
                        responseHandler: merchantCallback,
                        flowConfig: flow_config,
                        flowType: "payments"
                    }
                    window.loadBillDeskSdk(config)
                }
            </script>
        </body>
        </html>
        """

webView.loadHTMLString(htmlString, baseURL: nil)

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img