card.io provides fast, easy credit card scanning in mobile apps

Overview

Build Status

card.io SDK for Android

card.io provides fast, easy credit card scanning in mobile apps.

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:

compile 'io.card:android-sdk:5.5.1'

You can receive updates about new versions via a few different channels:

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 an app 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:

public void onScanPress(View v) {
    Intent scanIntent = new Intent(this, CardIOActivity.class);

    // customize these values to suit your needs.
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false

    // MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
    startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}

Next, we'll override onActivityResult() to get the scan result.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == MY_SCAN_REQUEST_CODE) {
        String resultDisplayStr;
        if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
            CreditCard scanResult = 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.isExpiryValid()) {
                resultDisplayStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n";
            }

            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.
  • Processing images can be memory intensive.
  • 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.

Comments
  • CardIOActivity.canReadCardWithCamera(this) returns false

    CardIOActivity.canReadCardWithCamera(this) returns false

    Hi there,

    I'm using Card.io library on Android 4.3 device, and I keep getting false from CardIOActivity.canReadCardWithCamera(this) in onResume().

    My manifest file, layout and java code is exactly same as the sample project (sample project runs fine), and I can't find why it returns false.

    Is there any way I can debug? Can you give me any comment? Thanks!

    opened by wassupnari 25
  • Android SDK scan credit card but does not produce output.

    Android SDK scan credit card but does not produce output.

    I am using card io Android SDK library (version 5.0.0) in Eclipse. The application opens the scan page and it scans the credit card but does not produce output ( showing credit card information). Please see the image URL of the screen short (scanning credit card): http://i.imgur.com/GFV3IKG.png Please help me on find out my mistake. I have tested my application on Samsung S4,Moto E, Sony xperia Z and Samsung S3. My credit card number provider is "ICICI Bank" and number starts with 4.

    Note: I have created Android project in Eclipse and please see the following link how I used processor libraries in my project (it may has problem) : http://i.imgur.com/iicjKjm.png

    opened by muraliandroid 20
  • Application Crash after strating the Activity io.card.payment.CardIOActivity;

    Application Crash after strating the Activity io.card.payment.CardIOActivity;

    These steps are followed by me..

    1. classes.jar from cardio-4.0.0.aar
    2. rename "classes.jar" to "card.io.jar", and copy jar into libs
    3. Calling it from MainActivity's button click :-
        Intent scanIntent = new Intent(this, CardIOActivity.class);
        scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: true
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
        scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false);
        scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); 
        scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true);
    startActivityForResult(scanIntent, 100);
    

    error page

    error1

    opened by dhannajha 19
  • Issues with Nexus 5x - Camera is upside down

    Issues with Nexus 5x - Camera is upside down

    There's an issue specifically with the Nexus 5x - images are upside down. It seems to be related to the way the camera orientation is being set.

    Supposedly the correct way to set it is here: http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation(int)

    For reference: https://code.google.com/p/android/issues/detail?id=191210 (See comment #4)

    Any chance you guys are working on a solution? Thanks in advance.

    opened by vhuynh 16
  • Issue with loading library file

    Issue with loading library file

    Required Information

    • card.io Android SDK Version: 5.4.2
    • Android Version and Device: Moto G 2nd Gen with Android 6.0.1

    Issue Description

    10-05 10:00:39.056 16099-16099/? I/card.io: Checking hardware support... 10-05 10:00:39.066 16099-16099/? I/card.io: card.io 5.4.2 09/27/2016 11:38:46 -0500 10-05 10:00:39.079 16099-16099/? E/card.io: Failed to load native library: dlopen failed: cannot locate symbol "__aeabi_memcpy" referenced by "/data/app/org.my.scanExample.debug-1/lib/arm/libcardioDecider.so"... 10-05 10:00:39.079 16099-16099/? W/card.io: - Processor type is not supported

    Building the project on Android studio using .aar as a library dependency, and facing the above error. Please suggest, if this i really a processor unsupported issue or not.

    opened by DivyanshuTechmahindra 15
  • Support ARMv8 chipset

    Support ARMv8 chipset

    The sdk cannot scan card on a Galaxy S6. Can you help me please.Despite that the Galaxy S6 is based on the exynos processor (ARM-based System-on-Chips).

    Here the log : D/card.io﹕ Loaded card.io decider library. nUseNeon():false,nUseTegra():false W/card.io﹕ unsupported processor - card.io scanning requires ARMv7 architecture W/card.io﹕ - Processor type is not supported W/card.io﹕ ERROR_NO_DEVICE_SUPPORT: This device cannot use the camera to read card numbers.

    opened by Bildev 14
  • More than one file was found with OS independent path 'lib/armeabi-v7a/libcardioDecider.so

    More than one file was found with OS independent path 'lib/armeabi-v7a/libcardioDecider.so

    General information

    • SDK/Library version: 5.5.1
    • Android Version and Device: Samsung S5 with Android 6.0

    Issue description

    I had this error when running app in Android Studio, complile is pass. I can't understand why this error appears. And I found nothing in Internet for the similar error when using card.io. perhaps this is particular for my project due to different dependencies I used.

    image

    opened by lantian699 10
  • Updating Card.io library doubled the size of my app.

    Updating Card.io library doubled the size of my app.

    I was about to release a new update to my app, noticed my app size was 20mb compared to the 10mb it was in the previous release.

    I used git bisect to figure out where the problem came from and it narrowed it down to a commit where I updated all the libraries that I use. So I reverted all the library updates one by one to see what library was causing it, and it was Card.io.

    Built the app with version 5.0.1 of this library, 11.1mb. updated the library to 5.1.1 (and eventually 5.1.2) and my app size jumped to 20.8mb.

    Are you guys aware of this? I removed the library before upgrading as you mentioned in your readme so that's not the problem. There seems to be something wrong with your library with the recent two updates.

    opened by MiralDesai 10
  • CardIO android usage: need to understand what it is that may be wrong

    CardIO android usage: need to understand what it is that may be wrong

    Hey guys, I am using the sdk in an app we are making.The iOS version of the app exists and works fine.The problem is , cards that are detected by the i/OS sdk arent working with android.Also, the sdk doesnt work as expected since the sample doesnt detect any cards either. There is an intent extra called CardIOActivity.EXTRA_SUPPRESS_SCAN, the value of which the sample doesnt manipulate,but the default seems to be false.When I followed this, CardIOActivity refused to give me a response in my activity's onActivityResult , user gets stuck on CardIOActivity and even when the correctly seems to be correctly detected, no response is given to activity.I switched the value of CardIOActivity.EXTRA_SUPPRESS_SCAN to true and voila, upon detecting the card, onActivityResult was getting called, but every time the result code was RESULT_SCAN_SUPPRESSED, which is a result of me passing CardIOActivity.EXTRA_SUPPRESS_SCAN as true. If I dont pass CardIOActivity.EXTRA_SUPPRESS_SCAN as true while starting CardIOActivity, I get no response on card scan at all.If i pass it as true, i get the suppressed response as mentioned above.

    I want to know what I am doing wrong, because a stackoverflow lookup hasnt revealed much for my problem.My project is stuck because of this anomaly and we need to move asap.

    question 
    opened by gnivsarkar007 9
  • Camera not opening

    Camera not opening

    When I tried the same code in Eclipse Project it does not open Camera in real and virtual device both, it is giving a CardDetail activity.How can i resolve this? capture

    opened by arthtilva 9
  • Card is recognized inside the box but image was not captured

    Card is recognized inside the box but image was not captured

    Required Information

    • card.io Android SDK Version: 5.3.4
    • Android Version and Device : 5.1.1 Moto XPlay

    My Master card is recognized and comes inside the green box but the image is never captured and onActivityResult was never called.

    opened by mihirjoshi21 8
  • App not extracting card info after rectangle frame completes

    App not extracting card info after rectangle frame completes

    General information:

    • SDK/Library version: 7, 5.1, 6
    • Android Version and Device: Samsung A5, Sony Z1, Nokia TA 1047

    Issue:

    Application does not extracts any information from scanning card after rectangle frame completes! I tested it with 3 different devices and many different cards but I got same result: when the rectangle frame completes on the card nothing happens. This is while the "Detect card-ish rectangle only" option works after the app detects the card frame but it just takes an image of it. Does it work for Paypal cards only? Please help me where I am wrong.

    opened by msndvlpr 0
  • onActivityResult is not getting called after a successful scan of credit card.

    onActivityResult is not getting called after a successful scan of credit card.

    onActivityResult is not getting called after a successful scan of credit card.

    using version 5.5.1

    General information

    • SDK/Library version:
    • Android Version and Device:

    Issue description

    opened by dineshkandan1990 2
  • Upgrade build gradle

    Upgrade build gradle

    Issue description

    I have issue when add compile 'io.card:android-sdk:5.5.1' is "Multiple dex files define Lio/card/payment/CardIOActivity;" I think this issue by conflict build tool gradle, please update gradle to latest version in card.id SDK.

    opened by tamtps 1
  • Support for more than 16 digits in card number

    Support for more than 16 digits in card number

    General information

    • SDK/Library version: 5.4.2
    • Android Version and Device: Android 7.1.2, Xiaomi Redmi 3

    Issue description

    May be fixed in newest version, but version 5.4.2 does not properly support bank cards with more than 16 digits in card number.

    Case A

    1. Start CardIOActivity to scan card with following code:
            Intent scanIntent = new Intent(activity, CardIOActivity.class);
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true);
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, true);
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false);
            startActivityForResult(scanIntent, SCAN_REQUEST_CODE);
    
    1. Try to scan a bank card with 18 digits.

    Expected result:

    • The card was scanned successfully and result was returned.

    Actual result:

    • A green rectangle is shown around the card, but nothing happens.

    Case B

    1. Start CardIOActivity to scan card with the same code.
    2. Press keyboard button at the bottom right corner.
    3. In EditText labeled "Card Number" try to enter one of these card numbers that is longer than 16 digits: https://www.paypalobjects.com/en_AU/vhelp/paypalmanager_help/credit_card_numbers.htm.

    Expected result:

    • Able to enter all the digits.

    Actual result:

    • When 16 digits are entered, input is being disabled and does not accept more digits.
    opened by niemandkun 0
Releases(5.5.1)
  • 5.5.1(Mar 17, 2017)

  • 5.5.0(Jan 27, 2017)

    • Update Gradle build plugin to 2.2.3.
    • Update compile and target SDK versions to 25.
    • Update NDK to r13b.
    • Increase minSdkVersion to 16.
    • Upgrade OpenCV to 2.4.13.
    Source code(tar.gz)
    Source code(zip)
  • 5.4.2(Sep 27, 2016)

    • Add Mastercard 2-series support.
    • Bump compile SDK to 24 for reals.
    • Compile distributed package with NDK to r12b (previous was r11c).
    • Update Android Gradle plugin to 2.2.0.
    Source code(tar.gz)
    Source code(zip)
  • 5.4.1(Sep 20, 2016)

  • 5.4.0(Jun 15, 2016)

    • Add ability to blur all digits in the scanned card image, minus any number of digits to remain unblurred, enabled via CardIOActivity.EXTRA_UNBLUR_DIGITS. (Thank you Michael Schmoock!)
    • Fix issue where Maestro cards were not correctly recognized #154.
    • Fix issue on Android 23 and above where CardIOActivity#canReadCardWithCamera() would return the incorrect value if permissions had not been granted #136. Now defaults to true in such cases.
    • Add missing locales to javadocs card.io-Android-source#75.
    • Upgrade gradle to 2.13.
    • Upgrade Android Gradle plugin to 2.1.0.
    Source code(tar.gz)
    Source code(zip)
  • 5.3.4(Apr 22, 2016)

  • 5.3.3(Apr 22, 2016)

  • 5.3.2(Mar 31, 2016)

  • 5.3.1(Mar 28, 2016)

  • 5.3.0(Jan 11, 2016)

  • 5.2.0(Dec 15, 2015)

    • Add Cardholder Name to list of available manual entry fields, enabled via CardIOActivity.EXTRA_REQUIRE_CARDHOLDER_NAME. (Thank you Dan Nizri and Zach Sweigart!)
    • Fix issue where certain devices would show the camera preview upside down #91.
    • Fix issue where null could be set in the return bundle value for CardIOActivity.EXTRA_SCAN_RESULT.
    • Upgrade build tools.
    Source code(tar.gz)
    Source code(zip)
  • 5.1.2(Oct 28, 2015)

  • 5.1.1(Oct 14, 2015)

  • 5.1.0(Oct 1, 2015)

    • Add arm64-v8a processor support #33-source, #51.
    • Add x86 processor support #26-source.
    • Add x86_64 processor support.
    • Add support for Android 23 new permission model for the Camera permission #78. When permission is granted, the SDK performs as in previous versions. When permission is or has already been denied, the SDK falls back to manual entry. Note: this SDK does not call the shouldShowRequestPermissionRationale() method and does not show a rationale. It is up to the implementor whether or not to show the Camera permission rationale before opening the SDK.
    • Populate CardIOActivity.EXTRA_CAPTURED_CARD_IMAGE when confirmation is shown #10-source.
    • Fix issue where setting EXTRA_KEEP_APPLICATION_THEME would not create buttons that matched the theme #24-source.
    • Add a default edit text hint color #22-source.
    • Fix leaking IntentReceiver #76.
    Source code(tar.gz)
    Source code(zip)
  • 5.0.1(Jun 4, 2015)

  • 5.0.0(Mar 10, 2015)

    • Add automatic expiry-scanning. You can disable this feature via the new EXTRA_SCAN_EXPIRY extra of CardIOActivity. Note: Expiry scans will not infrequently fail to obtain the correct expiry date. We are continuing to work to improve expiry-scanning accuracy.
    • Fix crash when the DataEntryActivity is missing extras #19).
    Source code(tar.gz)
    Source code(zip)
  • 4.0.2(Feb 23, 2015)

  • 4.0.1(Feb 11, 2015)

  • 4.0.0(Jan 21, 2015)

    • Distribute .aar file instead of .jar and .so files
    • New extras on CardIOActivity
      • EXTRA_SCAN_INSTRUCTIONS
      • EXTRA_HIDE_CARDIO_LOGO
      • EXTRA_SCAN_OVERLAY_LAYOUT_ID
      • EXTRA_SUPPRESS_SCAN
      • EXTRA_RETURN_CARD_IMAGE
      • EXTRA_KEEP_APPLICATION_THEME
      • EXTRA_USE_PAYPAL_ACTIONBAR_ICON
    • Remove deprecated extras and methods in CardIOActivity
      • canReadCardWithCamera(Context) (use canReadCardWithCamera() instead)
      • EXTRA_REQUIRE_ZIP (use EXTRA_REQUIRE_POSTAL_CODE instead)
    • New extra EXTRA_CAPTURED_CARD_IMAGE returned to calling Activity
    • New class BuildConfig
    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Oct 13, 2014)

    • Eliminate App Token. Developers no longer need to sign up on the card.io site before using card.io.
    • Add Icelandic (is) to our supported localizations. (Thank you, Martin Kaplan!)
    Source code(tar.gz)
    Source code(zip)
  • 3.1.6(Sep 16, 2014)

  • 3.1.5(May 1, 2014)

Owner
card.io
card.io credit card scanning
card.io
Android Weather Library: android weather lib to develop weather based app fast and easily

WeatherLib Android weather lib is an android weather aggregator. The lib helps you getting weather data from the most importat weather provider. It su

Surviving with android (by Francesco Azzola) 641 Dec 23, 2022
This SDK can be used to identify a user via passport or ID Card prove identity of user via Biometry comparing selfie and photo from chip of ID Doc

Verdi Mobile SDK This SDK can be used to identify a user via passport or Id Card. In this repository, you can find the library itself and the Sample a

null 5 Jan 3, 2022
Android library that provides for multiple image selection.

#MultipleImageSelect An android library that allows selection of multiple images from gallery. It shows an initial album (buckets) chooser and then im

Darshan Dorai 299 Nov 14, 2022
Offerwall for Android games and apps monetization.

Monlix Android SDK Monlix offerwall for Android Integration In the top level build.gradle file, add the following For Gradle < 7 allprojects { repo

Monlix 2 Jun 11, 2022
Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin

Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin. It supports all kind of shapes and all language letters e.g. english, arabic, Urdu, hindi etc.

null 9 Oct 16, 2022
Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Freshplanet 219 Nov 25, 2022
Desk360 Mobile Chat SDK for Android

Desk360 Chat Android SDK Introduction Desk360 Live Chat SDK is an open source Android library that provides live support to your customers directly fr

null 31 Dec 13, 2022
Frogo SDK - SDK Core for Easy Development

SDK for anything your problem to make easier developing android apps

Frogobox 10 Dec 15, 2022
CreditCardHelper 🖊️ A Jetpack-Compose library providing useful credit card utilities such as card type recognition and TextField ViewTransformations

CreditCardHelper ??️ A Jetpack-Compose library providing useful credit card utilities such as card type recognition and TextField ViewTransformations

Stelios Papamichail 18 Dec 19, 2022
💳 CreditCardView is an Android library that allows developers to create the UI which replicates an actual Credit Card.

CreditCard View CreditCardView is an Android library that allows developers to create the UI which replicates an actual Credit Card. Displaying and en

Vinay Gaba 769 Dec 14, 2022
ComposeCreditCardView - Jetpack Compose Credit Card View Library

ComposeCreditCardView Jetpack Compose Credit Card View Library Screenshots ??  

Umut Soysal 5 Sep 19, 2022
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. ?? EasyFlipView Built with ❤︎ by Wajahat Karim and

Wajahat Karim 1.3k Dec 14, 2022
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. ?? EasyFlipView Built with ❤︎ by Wajahat Karim and

Wajahat Karim 1.3k Dec 14, 2022
⭐️ Quick and easy QR Code scanning app created using Jetpack Compose. ☘️

QR-Code-Scanner Scan your QR codes easily and quickly. ⭐️ Google Play Store : Screenshots of the app : ?? Libraries Used in The Project : // Jetpa

Nisa Efendioğlu 12 Oct 8, 2022
This library provides GridAdapters(ListGridAdapter & CursorGridAdapter) which enable you to bind your data in grid card fashion within android.widget.ListView, Also provides many other features related to GridListView.

GridListViewAdapters This libarary enables you to implement GridView like card layout within ListView with added capabilites like Paginations, Additio

Biraj Patel 270 Nov 25, 2022
This library provides Easy Android ListView Adapters(EasyListAdapter & EasyCursorAdapter) which makes designing Multi-Row-Type ListView very simple & cleaner, It also provides many useful features for ListView.

EasyListViewAdapters Whenever you want to display custom items in listview, then only way to achieve this is to implement your own subclass of BaseAda

Biraj Patel 132 Nov 25, 2022
Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.

android-formidable-validation Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Pr

Linden 147 Nov 20, 2022
ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Project in Maintenance Mode Only The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enha

ZXing Project 30.5k Dec 27, 2022
Accept PayPal and credit cards in your Android app

Important: PayPal Mobile SDKs are Deprecated. The APIs powering them will remain operational long enough for merchants to migrate, but the SDKs themse

PayPal 802 Dec 22, 2022
android下自定义View之雷达扫描 The Radar (Scanning) View on Android 当扫描到对象的时候,通过水波纹的方式显示扫描到的对象,可以动态的随机添加,并且扫描到的对象是可以点击的……

RadarScanView 自定义View之雷达扫描 原理 关键是使用SweepGradient进行扫描渲染 关键代码如下: Shader shader = new SweepGradient(centerX, centerY, Color.TRANSPARENT, tailColo

郭攀峰 615 Dec 1, 2022