I've got this sample call:
curl -i https://sandbox.espago.com/api/tokens -u publickey: -d "card[first_name]=Jan" -d "card[last_name]=Kowalski" -d "card[number]=4242424242424242" -d "card[verification_value]=123" -d "card[year]=2014" -d "card[month]=02"
I need to make POST (AFNetworking 1.3) request, i tried this way:
[self.client setAuthorizationHeaderWithUsername:self.publicKey password:@""];
NSDictionary *parameters = (@{
@"card[first_name]" : firstName,
@"card[last_name]" : lastName,
@"card[number]" : cardNumber,
@"card[verification_value]" : verificationCode,
@"card[year]" : @(year),
@"card[month]" : monthString,
});
NSString *path = [NSString stringWithFormat:@"%@/tokens", ZWEspagoURL];
[self.client postPath:path
parameters:parameters
success:^(AFHTTPRequestOperation *operation, id responseObject) {
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
if(completion) completion(nil, error);
}];
But unfortunately i'm getting 401 or 422 HTTP Status codes ...
This curl command is 100% ok, working without problem