cv
card-validate
cargo install card-validate
cv

card-validate

💳 Detects and validates credit card numbers (type of card, number length and Luhn checksum).

by Valerian Saliou

2.2.2 (see all)License:MIT
cargo install card-validate
Readme

rs-card-validate

Build Status Dependency Status Buy Me A Coffee

Documentation

Crate

Detects and validates credit card numbers (type of card, number length and Luhn checksum).

Important notice: this is a complete rework of @rprotasov initial work, supporting more card providers and containing important validation fixes.

🇫🇷 Crafted in Brest, France.

Supported providers

Debit cards:

  • Visa Electron
  • Maestro
  • Forbrugsforeningen
  • Dankort

Credit cards:

  • Visa
  • MasterCard
  • American Express
  • Diners Club
  • Discover
  • UnionPay
  • JCB

Install library

In your Cargo.toml:

[dependencies]
card-validate = "2.1"

Validate a number

extern crate card_validate;

use card_validate::Validate;

let card_number = "5236313877109142";

match Validate::from(card_number) {
  Ok(result) => println!("Card type is: {}", result.card_type.name()),
  Err(err) => println!("Card is invalid: {:?}", err)
}

GitHub Stars

11

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

4

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
2.2.2
3yrs ago
2.2.1
4yrs ago
2.2.0
4yrs ago
2.1.6
4yrs ago
No alternatives found
No tutorials found
Add a tutorial