card_bin_ex v1.0.0 CardBinEx

Module to discover the CreditCard brand based in the first digits.

Valid CreditCard brands

brandalias
Visavisa
Eloelo
JBCjbc
Dinersdiners
Discoverdiscover
MasterCardmaster
American Expressamex

Link to this section Summary

Functions

Get the creditcard brand base in the first digits.

Get the creditcard brand base in the first digits and return only the brand.

Link to this section Functions

Link to this function

brand_from_number(number)

Get the creditcard brand base in the first digits.

Examples

iex> CardBinEx.brand_from_number("4716892")
{:ok, "visa"}

iex> CardBinEx.brand_from_number("9716892")
{:error, :card_brand, "9716892"}
Link to this function

brand_from_number!(number)

Get the creditcard brand base in the first digits and return only the brand.

Examples

  iex> CardBinEx.brand_from_number!("4716892")
  "visa"

  iex> try do
  ...>   CardBinEx.brand_from_number!("9716892")
  ...> rescue
  ...>   e in CardBinEx.Error -> IO.puts(e.message)
  ...> end
  invalid card number