Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 

README.md

Credit Card Validator

This project is a pure JavaScript implementation that offers credit card validation support. It is written modular such that one could bundle only the components that are required. So for instance the smallest footprint in its minimized form could be 1K. No external JS|PHP framework or module bundler is required at all.

The JavaScript implementation is splitted in few tiny modules (which can be bundled together). It answers the following questions:

  • if the credit card and/or CCV are syntactically valid (they match the issuer numbering pattern)
  • if the card expiry date is valid (basically it parses the string and compares it against the current date)
  • gives the credit card issuer name (American Express, Visa, MasterCard, Discover, DinersClub, JCB and Maestro only)

Furthermore the library contains some extended functionalities that aids in:

  • check the validity of a postal code length given the country code (handy if your checkout card form includes a Postal Code field)
  • check if a given country has Braintree Payment Gateway support (given the Braintree module one could easily create similar modules for Stripe, PayPal, etc)

What this repo includes

  • src directory contains the source code of the library (a tiny monolithic module)
  • src/deps directory contains other dependent JS modules that, with the exception of Utils and Constants, could be just discarded and still get a credit card validator library (without extended functionality)
  • dist directory contains a unminified and a minified bundle of the library (together with the bundle builder script)
  • demo directory contains a demo application (index.html,bundle.min.js,app.css,cc-badge.png)

Online Sandbox

http://sandbox.mynixworld.info/ccv-validator

About

Pure JavaScript|PHP class that aids in credit card validation

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.