How to Integrate to Create Credit Card Scanner App For Android

Previously, we explained how to Integrate to create Credit card scanning app for iPhone. Now today, we’re going to learn integration for Android.

As you might already know that the idea behind is to make the experience of paying smoother and easier by allowing users to directly scanning their credit cards using the camera, instead of typing credit card information manually. And with API integration in your Android app, you can add this functionality for your Android app users.

Whether you’ve your own business mobile app or an E-commerce app, you can integrate Android SDK to enable this credit card scanning functionality in your Android app. And to show how easy the integration process is, we’ll guide you through a step-by-step process and teach you how to integrate by creating a simple credit card scanner for Android.

Let’s Get Started

Open Android studio and create a new project. Set an Application name & package name.



Configure your project by Adding activity & set the activity name.




With this you have created a new project.

Now, add the dependency in your build.gradle:

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


Add permission in manifest

  <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>

Add Repo

    url ""


Once you add this dependency, the library will get downloaded and added to your project as soon as you sync your project.

Want To Develop A Credit Card Scanner Application?

Book your free consultation from app experts.

Now go to activity_main.xml and create UI. In this demo, we’re going to keep it simple and neat and will add only one add Button & Textview.

android:text="Scan Card"


Next, call CardIOActivity to scan card. The CardIOActivity will simply take user to the next screen and ask for permission to “allow access to camera”. Once users allows it, the app will let user scan credit card.

btnScan.setOnClickListener {
    val intent = Intent([email protected],
            .putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true)
            .putExtra(CardIOActivity.EXTRA_SCAN_EXPIRY, true)
            .putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, true)
            .putExtra(CardIOActivity.EXTRA_REQUIRE_CARDHOLDER_NAME, true)
            .putExtra(CardIOActivity.EXTRA_LANGUAGE_OR_LOCALE, "en")
            .putExtra(CardIOActivity.EXTRA_GUIDE_COLOR, Color.GREEN)
            .putExtra(CardIOActivity.EXTRA_RETURN_CARD_IMAGE, true)
    startActivityForResult(intent, REQUEST_SCAN)


Once your app fetches credit card information through camera, you’ll need to get card resulted stored, in order to show the user and proceed for the payment. So, the next step for you will be to get Card result via OnActivityResult.

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if ((requestCode == REQUEST_SCAN || requestCode == REQUEST_AUTOTEST) && data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
        tvCardDetail.visibility = View.VISIBLE
        var resultDisplayStr: String
        if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
            val scanResult = data.getParcelableExtra<CreditCard>(CardIOActivity.EXTRA_SCAN_RESULT)
            // Never log a raw card number. Avoid displaying it, but if necessary use scanResult.formattedCardNumber can intend of .redactedCardNumber
            resultDisplayStr = "Card Number: " + scanResult.formattedCardNumber + "\n"
            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."
        tvCardDetail.text = resultDisplayStr


Now run Application, click on Scan card Button, and place a credit card in front of the camera.


When the card is scan successfully then it’ll automatically show card details.


And done!

This brings us to end of our Android Cardview app tutorial. If you face any issue, you can comment down below. And if you want to hire Android developer to integrate this functionality into your Android or iOS app for you or create an Android app for your business from scratch, you can fill out below form with your requirements and our business analyst will get in touch with you within 24 hours.

Author Bio
Amit Patolia
Amit Patolia
Designation: Android Team Lead

Amit Patolia is an Android Team Lead at Space-O Technologies. He has over 9+ years of experience in Android app development. He has guided to develop over 100 Android apps with unique features and functionalities. He also has expertise in Kotlin-based apps.