BlinkCard mobile SDK

BlinkCard enables swift scanning of various payment and bank cards. By default, it extracts the card number and expiration date, but also CVV and cardholder name can be added. 

Go to BlinkCard product page

Code, documentation, and integration guides are available in our Github repositories below. To get your free demo license key (no credit card required), register on our developer dashboard.

Download free BlinkCard demo app

Try scanning various credit and bank cards with the BlinkCard app. Available on Android and iOS.

BlinkCard Web API

With Docker implementation for an on-premise or cloud integration.

Learn more

Integration sample codes

Copy to clipboard
/**
 * Set your license file. The recommended way is extending the Android Application class
 * and setting the license file in its onCreate callback.
 * Register on our dashboard to get the license key for your app.
 */
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        MicroblinkSDK.setLicenseFile("path/to/license/file/within/assets/dir", this);
    }
}

public class MyActivity extends Activity {
    private BlinkCardRecognizer mRecognizer;
    private RecognizerBundle mRecognizerBundle;
    
    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        
        // setup views, as you would normally do in onCreate callback
        
        // create BlinkCardRecognizer for scanning payment/debit card
        // see https://bit.ly/2W5n2rh for options
        mRecognizer = new BlinkCardRecognizer();

        // bundle recognizer into RecognizerBundle
        mRecognizerBundle = new RecognizerBundle(mRecognizer);
    }
  
    public void startScanning() {
        // Settings for BlinkCardActivity
        BlinkCardUISettings settings = new BlinkCardUISettings(mRecognizerBundle);
    
        // tweak settings as you wish
    
        // Start activity
        ActivityRunner.startActivityForResult(this, MY_REQUEST_CODE, settings);
    }
  
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == MY_REQUEST_CODE) {
            if (resultCode == BlinkCardActivity.RESULT_OK && data != null) {
                // load the data into all recognizers bundled within your RecognizerBundle
                mRecognizerBundle.loadFromIntent(data);

                // now every recognizer object that was bundled within RecognizerBundle
                // has been updated with results obtained during the scanning session

                // you can get the result by invoking getResult on recognizer
                BlinkCardRecognizer.Result result = mRecognizer.getResult();
                if (result.getResultState() == Recognizer.Result.State.Valid) {
                    // result is valid, you can use it however you wish
                }
            }
        }
    }

}
Copy to clipboard
import UIKit
import MicroBlink

class ViewController: UIViewController {
    var blinkCardRecognizer: MBBlinkCardRecognizer!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        MBMicroblinkSDK.sharedInstance().setLicenseResource("license", withExtension: "txt", inSubdirectory: "", for: Bundle.main)
    }

    @IBAction func didTapScan(_ sender: Any) {
        blinkCardRecognizer = MBBlinkCardRecognizer()
        blinkCardRecognizer.extractCvv = false
        blinkCardRecognizer.returnFullDocumentImage = true
        
        let recognizerCollection = MBRecognizerCollection(recognizers: [blinkCardRecognizer])
        
        let blinkCardOverlaySettings = MBBlinkCardOverlaySettings()
        let blinkCardOverlayViewController = MBBlinkCardOverlayViewController(settings: blinkCardOverlaySettings, recognizerCollection: recognizerCollection, delegate: self)
        
        let recognizerRunnerViewController: UIViewController = MBViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: blinkCardOverlayViewController)
        
        present(recognizerRunnerViewController, animated: true, completion: nil)
    }
}

extension ViewController: MBBlinkCardOverlayViewControllerDelegate {
    func blinkCardOverlayViewControllerDidFinishScanning(_ blinkCardOverlayViewController: MBBlinkCardOverlayViewController, state: MBRecognizerResultState) {
        /** This is done on background thread */
        blinkCardOverlayViewController.recognizerRunnerViewController?.pauseScanning()
        
        var message: String = ""
        var title: String = ""
        
        if blinkCardRecognizer.result.resultState == MBRecognizerResultState.valid {
            title = "Payment card"
            
            let fullDocumentImage: UIImage! = blinkCardRecognizer.result.fullDocumentFrontImage?.image
            print("Got payment card image with width: \(fullDocumentImage.size.width), height: \(fullDocumentImage.size.height)")
            
            // Save the string representation of the code
            message = blinkCardRecognizer.result.description
        }
        
        /** Needs to be called on main thread beacuse everything prior is on background thread */
        DispatchQueue.main.async {
            // present the alert view with scanned results
            
            let alertController: UIAlertController = UIAlertController.init(title: title, message: message, preferredStyle: .alert)
            
            let okAction: UIAlertAction = UIAlertAction.init(title: "OK", style: .default,
                                                             handler: { (action) -> Void in
                                                                self.dismiss(animated: true, completion: nil)
            })
            alertController.addAction(okAction)
            blinkCardOverlayViewController.present(alertController, animated: true, completion: nil)
        }
    }
    
    func blinkCardOverlayViewControllerDidTapClose(_ blinkCardOverlayViewController: MBBlinkCardOverlayViewController) {
        self.dismiss(animated: true, completion: nil)
    }
}
Copy to clipboard
#import "ViewController.h"
#import <UIKit/UIKit.h>
#import <Microblink/Microblink.h>

@interface ViewController () <MBBlinkCardOverlayViewControllerDelegate>

@property (nonatomic, nonnull) MBBlinkCardRecognizer *blinkCardRecognizer;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [[MBMicroblinkSDK sharedInstance] setLicenseResource:@"license" withExtension:@"txt" inSubdirectory:@"" forBundle:NSBundle.mainBundle];
}

- (IBAction)didTapScan:(id)sender {
    self.blinkCardRecognizer = [[MBBlinkCardRecognizer alloc] init];
    self.blinkCardRecognizer.extractCvv = NO;
    self.blinkCardRecognizer.returnFullDocumentImage = YES;
    
    MBRecognizerCollection *recognizerCollection = [[MBRecognizerCollection alloc] initWithRecognizers:@[self.blinkCardRecognizer]];
    MBBlinkCardOverlaySettings *overlaySettings = [[MBBlinkCardOverlaySettings alloc] init];
    
    MBBlinkCardOverlayViewController *blinkCardOveralyViewController = [[MBBlinkCardOverlayViewController alloc] initWithSettings:overlaySettings recognizerCollection:recognizerCollection delegate:self];
    
    UIViewController<MBRecognizerRunnerViewController>* recognizerRunnerViewController = [MBViewControllerFactory recognizerRunnerViewControllerWithOverlayViewController:blinkCardOveralyViewController];
    
    [self presentViewController:recognizerRunnerViewController animated:YES completion:nil];
}

- (void)blinkCardOverlayViewControllerDidFinishScanning:(nonnull MBBlinkCardOverlayViewController *)blinkCardOverlayViewController state:(MBRecognizerResultState)state {
    
    [blinkCardOverlayViewController.recognizerRunnerViewController pauseScanning];

    NSString *title;
    NSString *message;
    
    if (self.blinkCardRecognizer.result.resultState == MBRecognizerResultStateValid) {
        title = @"Payment card";
        
        UIImage *fullDocumentImage = self.blinkCardRecognizer.result.fullDocumentFrontImage.image;
        NSLog(@"Got payment card image with width: %f, height: %f", fullDocumentImage.size.width, fullDocumentImage.size.height);
        message = self.blinkCardRecognizer.result.description;
    }
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            [self dismissViewControllerAnimated:YES completion:nil];
        }];
        
        [alertController addAction:okAction];
        [blinkCardOverlayViewController presentViewController:alertController animated:YES completion:nil];
    });
}

- (void)blinkCardOverlayViewControllerDidTapClose:(nonnull MBBlinkCardOverlayViewController *)blinkCardOverlayViewController {
    [blinkCardOverlayViewController dismissViewControllerAnimated:YES completion:nil];
}
@end