TapCard/TapCard


A Java library used to read and extract data from NFC EMV credit cards.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}
	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.ckesc:EMV-NFC-Paycard-Enrollment:parent-2.1.1'
	}
	<dependency>
	    <groupId>com.github.ckesc</groupId>
	    <artifactId>EMV-NFC-Paycard-Enrollment</artifactId>
	    <version>parent-2.1.1</version>
	</dependency>

                            
    libraryDependencies += "com.github.ckesc" % "EMV-NFC-Paycard-Enrollment" % "parent-2.1.1"
        
        

                            
    :dependencies [[com.github.ckesc/EMV-NFC-Paycard-Enrollment "parent-2.1.1"]]
        
        

Readme


TapCard Build Status

Replace card number input with NFC tap!

Description

A Java library to let your app users enter an NFC or EMV card info in a flash – just by holding it to the back of their phone. Don’t lose clients because they hate to manually enter all the card details – this process on a phone is awkward.<br/>

Demo app available on the Google Play:

<a href="http://bit.ly/2uxKxPD"><img height="60px" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge.png" /></a>

Demo app screen

Go to GitHub repo

Getting started

Create the reader

nfcCardReader = new NFCCardReader(activity);

When you will be ready - wait for NFC card.

nfcCardReader.enableDispatch();

After this, app will activate NFC and start waiting for card. Once user is tapped phone, activity will got intent.

Check that it is right intent and pass it to library. Library processing is blocking so wrap it in async call.

You can use our Rx wrappers:

    @Override
    protected void onNewIntent(Intent intent) {
        if (nfcCardReader.isSuitableIntent(intent)) {
            textView.setText("Reading...");

            cardReadDisposable.dispose();
            cardReadDisposable = nfcCardReader
                    .readCardRx2(intent)
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(
                            emvCard -> fillCardNumber(emvCard.getCardNumber()),
                            throwable -> showError());
        }
    }

Don't forget to stop waiting if Activity is paused or card reading is not needed more.

nfcCardReader.disableDispatch();

Done! You got a card object, that contains all read data (Aid, card number, expiration date, card type, transactions history)

For more examples checkout samples directory of this repo

Download

Library is not published yet. But you can use it from JitPack!

Step 1. Add the JitPack repository to your build file

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
		compile 'com.github.TapCard.TapCard:android:master-SNAPSHOT'
	}

or for specific commit

	dependencies {
		compile 'com.github.TapCard.TapCard:android:6673d687ba'
	}

About fork

This is a fork of EMV-NFC-Paycard-Enrollment by Millau Julien.

Fork is aimed at better Android compatibility and simpler API.

Original library is heavy using Apache libraries. So for smaller method count used methods are included inside library sources and Apache library was detached from dependencies. Also log4j was replaced with simple logging, that can be easily configured via LoggerFactory.setLogWriter(LogWriter)

Build

To build the project launch:

./gradlew build

Bugs

Please report bugs and feature requests to the GitHub issue tracker.<br/> Forks and Pull Requests are also welcome.

Copyright and license

Copyright 2014 Millau Julien.

Copyright 2017 CkEsc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.