You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 12, 2019. It is now read-only.
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:
compile 'io.card:android-sdk:5.5.0'
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:
if (requestCode == MY_SCAN_REQUEST_CODE) { StringresultDisplayStr; if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) { CreditCardscanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
// Never log a raw card number. Avoid displaying it, but if necessary use getFormattedCardNumber() resultDisplayStr = "Card Number: " + scanResult.getRedactedCardNumber() + "\n";
// Do something with the raw number, e.g.: // myService.setCardNumber( scanResult.cardNumber );
if (scanResult.cvv != null) { // Never log or display a CVV resultDisplayStr += "CVV has " + scanResult.cvv.length() + " digits.\n"; }
if (scanResult.postalCode != null) { resultDisplayStr += "Postal Code: " + scanResult.postalCode + "\n"; } } else { resultDisplayStr = "Scan was canceled."; } // do something with resultDisplayStr, maybe display it in a textView // resultTextView.setText(resultDisplayStr); } // else handle other activity results }
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.