I was working through an iOS Stripe tutorial, and at one point, we need to create some kind of "STPCard" object to send to Stripe's server. What I'm wondering, is do we have to create the STPCard object ourselves, or is it already given to us in Stripe's framework?
If we do have to make it, could someone please provide some insight on how to go about doing it (ie: which properties it should have, etc). Any help would be greatly appreciated!
The tutorial gave the following block of code, but when I try to instantiate the STPCard, i'm getting a warning for unknown receiver.
- (IBAction)save:(id)sender {
STPCard *card = [[STPCard alloc] init];
card.number = self.paymentView.card.number;
card.expMonth = self.paymentView.card.expMonth;
card.expYear = self.paymentView.card.expYear;
card.cvc = self.paymentView.card.cvc;
[[STPAPIClient sharedClient] createTokenWithCard:card
completion:^(STPToken *token, NSError *error) {
if (error) {
[self handleError:error];
} else {
[self createBackendChargeWithToken:token];
}
}];
}
Stripe does want the credit card information collected from a user to be safe, so it treats the card info as an object, then return a token as result, which you will send to your backend so you can charge the card