card.io provides fast, easy credit card scanning in mobile apps.
Please be sure to keep your app up to date with the latest version of the SDK. All releases follow semantic versioning.
You can receive updates about new versions via a few different channels:
- Follow @cardio (also great to send us feedback)
- Subscribe to our card-io-sdk-announce list.
- "Watch" this GitHub repository
Also be sure to check and post to the Stack Overflow card.io tag.
The card.io iOS SDK includes header files and a single static library. We'll walk you through integration and usage.
- To use the card.io SDK, you'll need to sign up and get an app token.
- Supports target deployment of iOS version 5.0+.
- Supports armv7 and armv7s devices, but not armv6.
- Get the latest SDK by cloning this repo or downloading an archive of the most recent tag.
- Add the CardIO directory (containing several .h files and libCardIO.a) to your Xcode project.
- In your project's Build Settings, add
-lc++
toOther Linker Flags
. - Add these frameworks to your project.
Weak linking
for iOS versions back to 5.0 is supported.
- AVFoundation
- AudioToolbox
- CoreMedia
- CoreVideo
- MobileCoreServices
- OpenGLES
- QuartzCore
- Security
- UIKit
- Add card.io's open source license acknowledgments to your app's acknowledgments.
- Refer to the header files for more usage options and information.
Create a class (most likely a subclass of UIViewController
) that conforms to CardIOPaymentViewControllerDelegate
.
// SomeViewController.h
#import "CardIO.h"
@interface SomeViewController : UIViewController<CardIOPaymentViewControllerDelegate>
// ...
Start card.io card scanning:
// SomeViewController.m
- (IBAction)scanCard:(id)sender {
CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
scanViewController.appToken = @"YOUR_APP_TOKEN_HERE"; // get your app token from the card.io website
[self presentModalViewController:scanViewController animated:YES];
}
Write delegate methods to receive the card info or a cancellation:
// SomeViewController.m
- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)scanViewController {
NSLog(@"User canceled payment info");
// Handle user cancellation here...
[scanViewController dismissModalViewControllerAnimated:YES];
}
- (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)scanViewController {
// The full card number is available as info.cardNumber, but don't log that!
NSLog(@"Received card info. Number: %@, expiry: %02i/%i, cvv: %@.", info.redactedCardNumber, info.expiryMonth, info.expiryYear, info.cvv);
// Use the card info...
[scanViewController dismissModalViewControllerAnimated:YES];
}
- Processing images can be memory intensive, so make sure to test that your app properly handles memory warnings.
- For your users' security, obscure your app's cached screenshots.