Advertisement
Guest User

Untitled

a guest
Aug 27th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://api.stripe.com/v1/recipients"]];
  2.  
  3. [request setValue:[NSString stringWithFormat:@"Bearer %@",StripeSecretKey] forHTTPHeaderField:@"Authorization"];
  4.  
  5. NSString *params = [NSString stringWithFormat:@"name=JohnDoe&type=individual"];
  6.  
  7. request.HTTPMethod = @"POST";
  8. request.HTTPBody = [params dataUsingEncoding:NSUTF8StringEncoding];
  9. [NSURLConnection sendAsynchronousRequest:request
  10. queue:[NSOperationQueue mainQueue]
  11. completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
  12. {
  13. if (error)
  14. {
  15.  
  16. NSLog(@"ERROR: %@",error.userInfo);
  17.  
  18. }
  19. else
  20. {
  21. NSLog(@"data: %@", data);
  22. NSLog(@"data: %@", [[NSString alloc] initWithData:data encoding: NSUTF8StringEncoding]);
  23.  
  24. }
  25. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement