【发布时间】:2014-10-18 01:13:28
【问题描述】:
我正在开发一个需要我使用 Stripe 创建和更新收件人的 iOS 应用。当我运行代码时,我从收到的数据中收到错误:“2014-08-24 17:28:42.962 myapp[1703:60b] data: { “错误”: { "type": "invalid_request_error", "message": "收到未知参数:sk_test_******:", “参数”:“sk_test_******:” } }"
如果有人可以帮助我或向我展示另一种方法来向 Stripe 发送请求以创建新收件人,我不确定为什么我会收到此错误。
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://api.stripe.com/v1/recipients"]];
NSString *params = [NSString stringWithFormat:@"%@:&name=%@&type=individual&card=%@",StripeSecretKey,name,token.tokenId];
request.HTTPMethod = @"POST";
request.HTTPBody = [params dataUsingEncoding:NSUTF8StringEncoding];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
if (error)
{
NSLog(@"ERROR: %@",error);
}
else
{
NSLog(@"data: %@", response);
NSLog(@"data: %@", [[NSString alloc] initWithData:data encoding: NSUTF8StringEncoding]);
}
}];
【问题讨论】:
标签: ios objective-c xcode httprequest stripe-payments