card.io provides fast, easy credit card scanning in mobile apps.
NEW!!! card.io is now an open-source project!
Average time of recognition a business card is less than 2.5 seconds Character recognition rate higher than 98% Available for a variety of programming languages Can Be Integrated With Multiple Platforms Our SDK is able to integrated with iOS (iOS 6 and above), Android (2.3.
As of December 2014, all of the source code for card.io is now available at the card.io-iOS-source repo.
What does this mean for you?
- If you simply wish to integrate card.io into your mobile apps, then you can (and probably should) ignore the existence of card.io-iOS-source.
- But if you're curious about how card.io performs its magic, or if you'd like to improve the appearance or behavior of card.io, then come visit card.io-iOS-source!
Brought to you by
Stay up to date
Please keep your app up to date with the latest version of the SDK.All releases follow semantic versioning.
To receive updates about new versions:
- Follow @cardio (also great to send us feedback)
- Subscribe to our card-io-sdk-announce list
- 'Watch' this GitHub repository
You can find and start technical discussions using the Stack Overflow card.io tag.
Sample app
For a quick first look at card.io, we have included a very small sample application that you can build and run.
- Download the latest version of the SDK.
- Simply open the
SampleApp
folder or theSampleApp-Swift
folder and follow the instructions in theREADME.md
file you find there.
Instructions
The card.io iOS SDK includes header files and a single static library. We'll walk you through integration and usage.
Requirements
- The latest non-beta version of Xcode. (Older or newer versions might also work.)
- Supports target deployment of iOS version 6.1+ and instruction set armv7+ (including 64-bit).
Setup
If you use CocoaPods, then add this line to your podfile:
If you don't use CocoaPods, then:
- Download the latest version of the SDK.
- Add the CardIO directory (containing several .h files,
libCardIO.a
,libopencv_core.a
, andlibopencv_imgproc.a
) to your Xcode project. - In your project's Build Settings (in the
TARGETS
section, not thePROJECTS
section), add-lc++
toOther Linker Flags
. - Either:
- Add these frameworks to your project.Weak linking is supported.
- Accelerate
- AudioToolbox
- AVFoundation
- CoreGraphics
- CoreMedia
- CoreVideo
- Foundation
- MobileCoreServices
- OpenGLES
- QuartzCore
- Security
- UIKit
- or:
- Add only these frameworks to your project (as
Optional
[i.e., weak-linked] libraries):- Accelerate
- AVFoundation
- AudioToolbox
- CoreMedia
- MobileCoreServices
- and confirm that these two Build Settings are both enabled:
Enable Modules (C and Objective-C)
Link Frameworks Automatically
With or without CocoaPods:
- Add card.io's open source license acknowledgments toyour app's acknowledgments.
- Refer to the header files for more usage options and information.
- You should add the key
NSCameraUsageDescription
to your app'sInfo.plist
and set the value to be a string describing why your app needs to use the camera (e.g. 'To scan credit cards.'). This string will be displayed when the app initially requests permission to access the camera.
Sample code
You can use card.io in two ways:
As a view controller: Quick and easy. Create a
CardIOPaymentViewController
and present it modally. The card.io view controller handles all aspects of the UX, including manual entry as a fallback, all transitions, and number confirmation.As a view: More flexible. Create a
CardIOView
to do card scanning only and manage everything else yourself. This enables a broader range of presentations, such as in-place transitions, but requires that you handle the rest of the UI yourself.
Integrate as a View Controller
Create a class (most likely a subclass of UIViewController
) that conforms to CardIOPaymentViewControllerDelegate
.
Make an optional call to speed up the subsequent launch of card.io scanning:
Start card.io card scanning:
Write delegate methods to receive the card info or a cancellation:
Integrate as a View
CardIOView is new as of card.io Version 3.3.0 (September 2013). We look forward to seeing how creative developers integrate it into their apps. If you do something cool with it, share it with @cardio! We also look forward to quickly resolving any issues that you may discover.
Create a class (most likely a subclass of UIViewController
) that conforms to CardIOViewDelegate
.
Using a CardIOView provides UI flexibility. Here are two sample integration options:
- Create a CardIOView when you need it, and then delete it when its work is finished.
- Include a hidden CardIOView in your view, show it when you need it, and then hide it when its work is finished.
Option 1: Create a CardIOView when you need it
Confirm that the user's device is capable of scanning cards:
Make an optional call to speed up the subsequent launch of card.io scanning:
Start card.io card scanning:
Write the delegate method to receive the results:
Include a method to cancel card scanning:
Option 2: Include a hidden CardIOView in your view
Make an IBOutlet property:
In your .xib, include a CardIOView, mark it as hidden
, and connect it to the IBOutlet property. (Note: usually you will want to set the background color of the CardIOView to clearColor
.)
After confirming that the user's device is capable of scanning cards, set the delegate
property of the CardIOView:
Make an optional call to speed up the subsequent launch of card.io scanning:
Start card.io card scanning:
Write the delegate method to receive the results:
Include a method to cancel card scanning:
Hints & Tips
- 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.
Note: By default, aCardIOPaymentViewController
automatically blurs its own screens when the app is backgrounded. ACardIOView
does not do any automatic blurring. - The first time that you create either a
CardIOPaymentViewController
or aCardIOView
, the card.io SDK must load resources, which can result in a noticeable delay. To avoid this delay you may optionally call[CardIOUtilities preloadCardIO]
in advance, so that this resource loading occurs in advance on a background thread.
Stay up to date
Please be sure to keep your app up to date with the latest version of the SDK.All releases follow semantic versioning.
The latest version is available via mavenCentral()
. Just add the following dependency:
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.
Integration instructions
The information in this guide is enough to get started. For additional details, see our javadoc.
(Note: in the past, developers needed to sign up at the card.io site and obtain anapp token
. This is no longer required.)
Requirements for card scanning
- Rear-facing camera.
- Android SDK version 16 (Android 4.1) or later.
- armeabi-v7a, arm64-v8, x86, or x86_64 processor.
A manual entry fallback mode is provided for devices that do not meet these requirements.
Setup
Add the dependency in your build.gradle
:
Sample code (See the SampleApp for an example)
First, we'll assume that you're going to launch the scanner from a button,and that you've set the button's onClick
handler in the layout XML via android:onClick='onScanPress'
.Then, add the method as:
Next, we'll override onActivityResult()
to get the scan result.
Hints & Tips
- Javadocs are provided in this repo for a complete reference.
- Note: the correct proguard file is automatically imported into your gradle project from the
aar
package. Anyone not using gradle will need to extract the proguard file and add it to their proguard config. - card.io errors and warnings will be logged to the 'card.io' tag.
- If upgrading the card.io SDK, first remove all card.io libraries so that you don't accidentally ship obsolete or unnecessary libraries. The bundled libraries may change.
- Processing images can be memory intensive.
- Memory Analysis for Android Applications provides some useful information about how to track and reduce your app's memory useage.
- card.io recommends the use of SSL pinning when transmitting sensitive information to protect against man-in-the-middle attacks.
Contributing
Please read our contributing guidelines prior to submitting a Pull Request.
License
Please refer to this repo's license file.