【发布时间】:2017-08-15 09:46:15
【问题描述】:
所以我正在尝试设置我的 Stripe 托管帐户,而我的第一步是想要实际创建用户。我正在使用 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)")
}
}
}
但是现在当我发送请求时,我收到了这个错误,在网上到处搜索之后,我似乎无法理解我做错了什么,因为这些是放在 Stripe 文档中的确切参数
SUCCESS: {
error = {
message = "Received unknown parameter: {\"Country\":\"US\",\"Managed\":\"true\"}";
param = "{\"Country\":\"US\",\"Managed\":\"true\"}";
type = "invalid_request_error";
};
}
【问题讨论】:
标签: ios json swift alamofire stripe-payments