【问题标题】:Getting unknown parameter error from Stripe从 Stripe 获取未知参数错误
【发布时间】: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


    【解决方案1】:

    可能是因为“true”应该是 Bool 而不是字符串?所以删除 true 周围的引号,看看是否有效。

    【讨论】:

    • 不走运 =/,我最终还是得到了同样的结果 SUCCESS: { error = { message = "Received unknown parameter: {\"managed\":true,\"country\":\ “我们\”}”;参数 = "{\"托管\":true,\"国家\":\"美国\"}"; type = "invalid_request_error"; }; }
    猜你喜欢
    • 2019-09-10
    • 2019-09-20
    • 1970-01-01
    • 2021-03-10
    • 1970-01-01
    • 2021-02-08
    • 2019-03-16
    • 2019-05-14
    • 2015-09-01
    相关资源
    最近更新 更多