1

I am implementing a custom Stripe SDK and as a test I have a method called pay:

-(void)pay{
STPCardParams *cardParams = [[STPCardParams alloc] init];
cardParams.number = @"4242424242424242";
cardParams.expMonth = 10;
cardParams.expYear = 2018;
cardParams.cvc = @"123";
[[STPAPIClient sharedClient] createTokenWithCard:cardParams completion:^(STPToken *token, NSError *error) {
    if (error) {
        // show the error, maybe by presenting an alert to the user
    } else {
        [self submitTokenToBackend:token completion:^(NSError *error) {
            if (error) {
                // show the error
            } else {
                //[self showReceiptPage];
            }
        }];
    }
}];
}

I am going to create the backend script to charge, but my issue is actually just creating the method to take in: submitTokenToBackend:token completion:^(NSError *error)

I tried: -(void)submitTokenToBackend:(STPToken *)token: (NSError*) error{

But this is not working...any ideas how I would make that method?

Bista
  • 7,869
  • 3
  • 27
  • 55
Ger
  • 51
  • 3
  • what do you mean by not working, i mean where you are getting error or crash or whats your real problem? – Mahesh Agrawal Sep 28 '16 at 16:18
  • by looking at your code, i can just guess this thing that, you should use tokenid of token object. – Mahesh Agrawal Sep 28 '16 at 16:20
  • I'm just trying to write the method to take in the submitTokenToBackend- i'm not sure how to format the beginning of that method. – Ger Sep 28 '16 at 16:30
  • 1
    use AFNetworking as you are using objective c and send post request with the token as a value for a key and receive in backend from post request. This will be the better way – Mahesh Agrawal Sep 28 '16 at 16:32
  • This may help you: http://goshdarnblocksyntax.com/ – Adam Jenkins Sep 28 '16 at 16:38
  • 1
    Possible duplicate of [Declare a block method parameter without using a typedef](http://stackoverflow.com/questions/5486976/declare-a-block-method-parameter-without-using-a-typedef) – Adam Jenkins Sep 28 '16 at 16:42

0 Answers0