func createStripeConnectAccount() { let parameters: [String:Any] = [ "type" : "express", "country" : "US", // "capabilities": [["card_payments"]["requested"], // "capabilities[transfers][requested]": true, // "business_type": "individual", "business_profile[url]": "https://google.com"] let url = "https://api.stripe.com/v1/accounts" let api_key = "add test api key here" let loginData = api_key.data(using: String.Encoding.utf8) let base64LoginString = loginData?.base64EncodedString() print("key : ", (base64LoginString ?? "") as String) let headers: HTTPHeaders = ["Authorization": "Basic \(base64LoginString!)", "Content-Type": "application/x-www-form-urlencoded", "Accept": "*/*"] AF.request(url, method: .post, parameters: parameters, encoding: URLEncoding.httpBody, headers: headers) .responseDecodable(of: DecodableType.self) { response in switch response.result { case .success(let dict): print("success ", response.result, dict) let res = dict.id print("ID1 : ", res) case .failure(let error): print("Failure : ", error) } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter