Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-nfc-card-reader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-nfc-card-reader

An NFC reader specifically for credit/debit cards.

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-nfc-card-reader

Description

This package is specifically designed to scan credit/debit cards using an Android devices NFC reader and return the card number, expiry and card type.

This package will only work on Android and isn't available for iOS as of 2020 because Apple do not allow 3rd party iPhone apps to use the Core NFC framework.

Getting started

$ npm install react-native-nfc-card-reader --save

For Gradle 7.0 and greater you can do:

npm install "https://github.com/jackbayliss/react-native-nfc-card-reader.git#gradle7.0" --save

Mostly automatic installation

$ react-native link react-native-nfc-card-reader

Usage

import NfcCardReader from 'react-native-nfc-card-reader';

NfcCardReader.startNfc(function(cardDetails){
     // Card details contain the callback data below, see the options.
     that.setState({cardNumber : cardDetails.cardNumber})
     that.setState({expiryDate : cardDetails.expiryDate})
     that.setState({cardType : cardDetails.cardType})
 })

Ensure you add the following to your AndroidManifest.xml located in android\app\src\main

<activity android:name="com.jackbayliss.nfcreader.NfcCardReaderActivity"/>

Methods

startNfc(callback) -> Will start the NFC Activity and expects a callback function that will return the card details it's scanned.

Callback data

cardType -> Provides the type of the card scanned.

cardNumber -> Provides the full card number scanned.

expiryDate -> Providers the expiry date of the card scanned.

firstName -> Card owners first name.

lastName -> Card owners last name.

Example App

You can find the sample app here

Contributing

I am by no means an Android developer, but saw this as a huge thing no one had produced for React Native. So, if you can expand or improve on my basic implementation feel free to create a pull request.

License

MIT - expanded from here

A special thanks to pro100svitlo for their library which gave me the ability to create this module. A special thanks to decoder10 for fixing a few issues, and adding firstname / lastname - as well as allowing any NFC cards to be scanned.

Keywords

FAQs

Package last updated on 30 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc