let parameters: [String:Any] = [ "country" : "US", "type" : "custom", "capabilities": ["card_payments": ["requested": "true"], "transfers": ["requested": "true"]]] //"business_type": "individual", // "business_profile[url]": "https://google.com"] let url = "https://api.stripe.com/v1/accounts" let api_key = "" 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, headers: headers) .responseJSON(completionHandler: { (response) in do { let json = try JSON(data: response.data!) print(json["id"]) } catch let error { print(error.localizedDescription) } })
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