integration of Adyen payment-gateways not working in iOS and swift 4

Getting an error while integrating Adyen from Adyen documentation. I am new for intrigrating payment-gateways

Fatal error: Failed to parse payment session response: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}: file /Users/logisch-apple01/Desktop/PodWithAdyen/PodWithAdyen/ViewController.swift, line

     func requestPaymentSession(withToken token: String, for checkoutController: CheckoutController, responseHandler: @escaping (String) -> Void) {    let url = URL(string: "https://checkoutshopper-test.adyen.com/checkoutshopper/demoserver/paymentSession")!

    let parameters: [String: Any] = [
        "amount": [
            "currency": "EUR",
            "value": 17408
        ],
        "channel": "ios",
        "reference": "Your order number",
        "token": "Token generated by Adyen",
        "returnUrl": "my-shopping-app://",
        "countryCode": "NL",
        "shopperReference": "user349857934"
    ]

    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    request.httpBody = try? JSONSerialization.data(withJSONObject: parameters, options: [])
    request.allHTTPHeaderFields = [
        "Content-Type": "application/json",
        "X-Demo-Server-API-Key": "API key" // Replace with your own Checkout Demo API key.
    ]

    let session = URLSession(configuration: .default)
    session.dataTask(with: request) { data, _, error in
        if let error = error {
            fatalError("Failed to retrieve payment session: \(error)")
        } else if let data = data {
            do {
                guard let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { fatalError() }
                guard let paymentSession = json["paymentSession"] as? String else { fatalError() }

                responseHandler(paymentSession)
            } catch {
                fatalError("Failed to parse payment session response: \(error)")
            }
        }
        }.resume()
}