All Projects → cholojuanito → Credit_card_type_detector

cholojuanito / Credit_card_type_detector

Licence: mit
A Dart package that detects credit card types based on their prefixes

Programming Languages

dart
5743 projects
dartlang
94 projects

Projects that are alternatives of or similar to Credit card type detector

pyamex
Python library for accessing American Express account data
Stars: ✭ 15 (-21.05%)
Mutual labels:  credit-card
Android Card Form
A ready-made card form layout that can be included in your Android app, making it easy to accept credit and debit cards.
Stars: ✭ 310 (+1531.58%)
Mutual labels:  credit-card
Vue Interactive Paycard
Credit card form with smooth and sweet micro-interactions
Stars: ✭ 5,451 (+28589.47%)
Mutual labels:  credit-card
gnt
🍸 GraphQL Normalized Types
Stars: ✭ 32 (+68.42%)
Mutual labels:  credit-card
Bankcardformat
💳 自动格式化银行卡号的EditText,卡号格式化、归属银行及卡别判断
Stars: ✭ 273 (+1336.84%)
Mutual labels:  credit-card
Mfcard
Easily integrate Credit Card payments module in iOS App. Swift 4.0
Stars: ✭ 356 (+1773.68%)
Mutual labels:  credit-card
Credit
An example project that predicts risk of credit card default using a Logistic Regression classifier and a 30,000 sample dataset.
Stars: ✭ 18 (-5.26%)
Mutual labels:  credit-card
Swipeablecard
A simple implementation of swipe card like StreetView
Stars: ✭ 812 (+4173.68%)
Mutual labels:  credit-card
Cleave.js
Format input text content when you are typing...
Stars: ✭ 17,098 (+89889.47%)
Mutual labels:  credit-card
Card.io Android Source
The open-source code for the card.io-Android-SDK: provides fast, easy credit card scanning in mobile apps
Stars: ✭ 549 (+2789.47%)
Mutual labels:  credit-card
Luhn
Smooth UI for Credit Card Entry on Android device, perform check for supported credit card types , pan length and luhn check. Inspired by Uber credit card entry interface
Stars: ✭ 257 (+1252.63%)
Mutual labels:  credit-card
Emvemulator
This Android app collects Mag-Stripe data and CVC3 codes from PayPass cards and emulates that information.
Stars: ✭ 271 (+1326.32%)
Mutual labels:  credit-card
Mini Player
Stars: ✭ 435 (+2189.47%)
Mutual labels:  credit-card
vgs-collect-ios
VGS Collect iOS SDK
Stars: ✭ 17 (-10.53%)
Mutual labels:  credit-card
Android Submit Credit Card Flow
💳 implementation of credit card form in material design
Stars: ✭ 628 (+3205.26%)
Mutual labels:  credit-card
ember-credit-card
"make your credit card form dreamy in one line of code"
Stars: ✭ 89 (+368.42%)
Mutual labels:  credit-card
Braintree android
Braintree SDK for Android
Stars: ✭ 343 (+1705.26%)
Mutual labels:  credit-card
Moyasar Php
Moyasar PHP client library
Stars: ✭ 5 (-73.68%)
Mutual labels:  credit-card
Creditcardview
💳 CreditCardView is an Android library that allows developers to create the UI which replicates an actual Credit Card.
Stars: ✭ 744 (+3815.79%)
Mutual labels:  credit-card
Payment
💰 A jQuery-free general purpose library for building credit card forms, validating inputs and formatting numbers.
Stars: ✭ 467 (+2357.89%)
Mutual labels:  credit-card

credit_card_type_detector | Credit Card Type Detector

A Dart package that detects credit card types based on the current credit card number patterns

This is a port from Braintree's credit-card-type module

Gif of the example app

Installing

  1. Add dependency to your pubspec.yaml

    Get the current version in the 'Installing' tab on pub.dartlang.org

dependencies:
    credit_card_type_detector: ^1.0.2
  1. Import the package
import 'package:credit_card_type_detector/credit_card_type_detector.dart';

Usage

import 'package:credit_card_type_detector/credit_card_type_detector.dart';

String visa = "4647 7200 6779 1032";

var type = detectCCType(visa);

assert(type == CreditCardType.visa)

Check out the example app in the example directory or the 'Example' tab on pub.dartlang.org for a more complete example using the BLoC pattern

Features

No external dependencies

Supported cards:

* Visa
* Mastercard
* American Express
* Discover
* Diners Club
* JCB
* Union Pay
* Maestro
* Mir
* Elo
* Hiper/Hipercard

Pattern Detection

Each card type has a corresponding list of patterns. See the cardNumPatterns map. Each pattern is an array of strings that represents a range of numbers or a single number. These numbers correspond to the Issuer Identification number (IIN) for the credit card company.

If the pattern is an array with a single number, the package compares it against the card number. Partial matches for card numbers that are shorter than the pattern also match. I.e. given the pattern 123, then the card numbers 1, 12, 123, 1234 will all match, but 2, 13, and 124 will not.

If the pattern is an array of numbers, then the card number is checked to be within the range of those numbers. Again, partial matches are accepted. I.e. given the range [100, 123], then the card numbers 1, 10, 100, 12, 120, 123 will all match, but 2, 13, and 124 will not.

The package loops over every card type and everyone of its corresponding patterns.

API

detectCCType(String number)

Returns: A CreditCardType enum.

I.e. CreditCardType.visa for any card number that starts with '4'.

Author

Tanner Davis (Cholojuanito) - Creator and repo owner - Github Profile

License

This project is licensed under the MIT License - see the LICENSE file for more details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].