Card Scanner

PCI compliance during scanning is required for companies that deal with payment card information. VGS Collect SDK provides several card scan solutions for the Payment Card Industry to help protect your businesses and the sensitive information of your consumers. You can add one of the proposed card scanning solutions into your application.

BlinkCard - is an AI-driven credit card scanning solution The VGS card scanner module helps to integrate the scanner with VGSCollectSDK.

It's required to use only the Card Scan Modules listed here, which are audited by VGS PCI requirements.

CardScan (BlinkCard) module

You can add a card scanning solution to your application by adding android BlinkCard adapter.

It provides a fast and easy way to scan payment cards and import them to VGS Collect. This tutorial is aimed at helping you to adapt the BlinkCard SDK to the VGS Collect Android SDK.

NoteWe offer already existing solution for using BlinkCard and still stay in PCI scope. Please contact with BlinkCard team if you have any issues related to the core API of the card scanner.

See below for more information about how to integrate BlinkCard SDK into your app, and also check the latest release notes.

You can start by watching our step-by-step tutorial, in which you’ll find out how to make BlinkCard SDK a part of your Android app.

To see BlinkCard in action, check our demo app.

Pricing

BlinkCard The module is a paid integration. Please contact Microblink for more details.

Before you start

Using the BlinkCard API in your app requires a valid license. You can obtain a trial license by registering for Microblink dashboard. After registering, you will be able to generate a license for your app. The license is bound to the package name of your app, so please make sure you enter the correct package name when asked.

Integration

Note it is critical not to forget to import VGS Collect as well. If you’re not familiar with the VGS Collect Android SDK, we highly recommend starting from our integration documentation and following the steps in the guidelines.

In your build.gradle add Microblink maven repository to the repositories list.

repositories {
    maven { url 'https://maven.microblink.com' }
}

Add adapter-blinkcard as a dependency.

dependencies {
     implementation 'com.verygoodsecurity:vgscollect:1.7.5' // required version 1.7.5 or above
     implementation 'com.verygoodsecurity.api:adapter-blinkcard:<latest-version>'
}

Configure Your App

Configure the Microblink license in Application.onCreate callback.

import android.app.Application
import com.microblink.blinkcard.MicroblinkSDK

class App: Application() {

    override fun onCreate() {
        super.onCreate()
        MicroblinkSDK.setLicenseKey("<KEY>", this)
    }
}

Add VGSCardNumberEditText to your activity XML file.

<?xml version="1.0" encoding="utf-8"?><LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical"    android:padding="16dp">    <com.verygoodsecurity.vgscollect.widget.VGSTextInputLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        app:hintEnabled="true"        app:hint="Card number"        app:boxCornerRadius="4dp"        app:boxBackgroundModes="outline"        app:boxStrokeColor="#2f426f">        <com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditText            android:id="@+id/cardNumber"            android:layout_width="match_parent"            android:layout_height="wrap_content"            app:fieldName="cardNumber"            app:numberDivider="-"            app:cardBrandIconGravity="end"/>    </com.verygoodsecurity.vgscollect.widget.VGSTextInputLayout>    <Button        android:id="@+id/scanBtn"        android:text="Scan"        android:layout_marginStart="16dp"        android:layout_marginEnd="16dp"        android:layout_width="match_parent"        android:layout_height="wrap_content"/></LinearLayout>XML

Bind VGSCardNumberEditText to your VGSCollect object instance.

collect = VGSCollect(this, "tntsfeqzp4a", Environment.SANDBOX)
val cardNumberEditText = findViewById<VGSCardNumberEditText>(R.id.cardNumber)
collect.bindView(cardNumberEditText)

Create scanning intent using VGSBlinkCardIntentBuilder and link `VGSCardNumberEditText`` to it. VGS Collect would automatically import received data into your input fields. For this, you need to link fields with incoming data. Use the field name to notify VGSCollect which type of incoming data it should apply to.

NoteIf you have not set it up, the VGSCollect won't receive results of scanning.KotlinJava

val intent = VGSBlinkCardIntentBuilder(this)
    .setCardNumberFieldName(cardNumberEditText.getFieldName())
    .build()

Start scanning intent for the result. After scanning the complete pass result to VGSCollect in onActivityResult callback.

import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.verygoodsecurity.vgscollect.core.Environment
import com.verygoodsecurity.vgscollect.core.VGSCollect
import com.verygoodsecurity.api.blinkcard.VGSBlinkCardIntentBuilder
import com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditText

class MainActivity : AppCompatActivity(R.layout.activity_main) {

    companion object {

        const val USER_SCAN_REQUEST_CODE = 0x7
    }

    private val collect: VGSCollect by lazy { VGSCollect(this, "tntsfeqzp4a", Environment.SANDBOX) }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val cardNumberEditText = findViewById<VGSCardNumberEditText>(R.id.cardNumber)
        collect.bindView(cardNumberEditText)
        findViewById<Button>(R.id.scanBtn)?.let {
            val intent = VGSBlinkCardIntentBuilder(this)
                .setCardNumberFieldName(cardNumberEditText.getFieldName())
                .build()
            startActivityForResult(intent, USER_SCAN_REQUEST_CODE)
        }
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        collect.onActivityResult(requestCode, resultCode, data)
    }

    override fun onDestroy() {
        collect.onDestroy()
        super.onDestroy()
    }
}

Last updated