所以我试图设置我的Stripe Managed帐户,我的第一步是想要真正创建用户。我使用Alamofire代表我的用户创建条带帐户。这是我用来执行此操作的代码:
func alamoTest(){
let headers: HTTPHeaders = [
"Authorization":"Bearer tokenxxxxxxxx",
"Content-Type":"application/x-www-form-urlencoded"]
let url = "https://api.stripe.com/v1/accounts"
let params : [String: AnyObject] = ["managed":"true" as AnyObject,"country":"US" as AnyObject]
Alamofire.request(url, method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).responseJSON {(response) in
print("this is what comes out", response)
if let data = response.data {
let json = String(data: data, encoding: String.Encoding.utf8)
print("Response:\(json)")
}
}
}
但是现在当我发送请求时,我收到了这个错误,并且在网上到处搜索后,我似乎无法理解我做错了什么,因为这些是确切的参数。条带文档
SUCCESS: {
error = {
message = "Received unknown parameter: {\"Country\":\"US\",\"Managed\":\"true\"}";
param = "{\"Country\":\"US\",\"Managed\":\"true\"}";
type = "invalid_request_error";
};
}
答案 0 :(得分:0)
可能因为“真实”应该是Bool而不是字符串?所以删除周围的引号,看看是否有效。