Coder Social home page Coder Social logo

cardscan-android's Introduction

CardScan

CardScan Android installation guide

Contents

Requirements

  • Android API level 19 or higher

Installation

We publish our library in the jcenter repository, so for most gradle configurations you only need to add the dependency to your app's build.gradle file:

dependencies {
    implementation 'com.getbouncer:cardscan:1.0.5001'
}

Using CardScan

To use CardScan, you create a ScanActivity intent, start it, and get the results via the onActivityResult method:

public void scanCard() {
    ScanActivity.start(this);
}

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

    if (ScanActivity.isScanResult(requestCode)) {
        if (resultCode == ScanActivity.RESULT_OK && data != null) {
            CreditCard scanResult = ScanActivity.creditCardFromResult(data);

	    // at this point pass the info to your app's enter card flow
	    // this is how we do it in our example app
            Intent intent = new Intent(this, EnterCard.class);
            intent.putExtra("card", scanResult);
            startActivity(intent);
        } else if (resultCode == ScanActivity.RESULT_CANCELED) {
            Log.d(TAG, "The user pressed the back button");
        }
    }
}

Adding to Your App

When added to your app successfully, you should see the card numbers being passed into your payment form. This is what it looks like using a standard Stripe mobile payment form:

alt text

Authors

Sam King and Rui Guo

License

CardScan is available under the BSD license. See the LICENSE file for more info.

cardscan-android's People

Contributors

kingst avatar mshafrir-stripe avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.