CreditcardIdentifier (CreditCard Identifier v2.3.0)
View SourceCredit Card BIN Validator
This module provides credit card validation using bin-cc data.
Examples
brand = CreditcardIdentifier.find_brand("4012001037141112")
# Returns %{name: "visa", ...}
CreditcardIdentifier.supported?("4012001037141112")
# Returns true
Summary
Functions
Identify the credit card brand.
Get information about a specific brand.
Get information about a specific brand with custom brands list.
Get detailed information about a specific brand.
Get all brand data.
Get all detailed brand data.
List all supported brands.
List all supported brands from custom brands list.
Validate a credit card number using the Luhn algorithm.
Check if card number is supported.
Check if card number is supported with custom brands list.
Validate CVV for a specific brand.
Validate CVV for a specific brand with custom brands list.
Functions
Identify the credit card brand.
Parameters
- card_number: Credit card number as string
- opts: Keyword list with options
- detailed: boolean, if true returns detailed brand info (default: false)
Returns
Brand map or nil if not found. If detailed: true, includes :matched_pattern and :matched_bin fields.
Examples
iex> brand = CreditcardIdentifier.find_brand("4012001037141112")
iex> brand.name
"visa"
iex> brand = CreditcardIdentifier.find_brand("4012001037141112", detailed: true)
iex> brand.scheme
"visa"
Get information about a specific brand.
Parameters
- brand_name: Brand name (e.g., "visa", "mastercard")
Returns
Brand map or nil if not found
Get information about a specific brand with custom brands list.
Parameters
- brand_name: Brand name (e.g., "visa", "mastercard")
- brands: List of brand data
Returns
Brand map or nil if not found
Get detailed information about a specific brand.
Parameters
- scheme: Scheme name (e.g., "visa", "mastercard")
Returns
Detailed brand map or nil if not found
Get all brand data.
Returns
List of brand maps with pre-compiled regex patterns
Get all detailed brand data.
Returns
List of detailed brand maps
List all supported brands.
Returns
List of brand names
List all supported brands from custom brands list.
Parameters
- brands: List of brand data
Returns
List of brand names
Validate a credit card number using the Luhn algorithm.
Parameters
- number: Credit card number as string (digits only)
Returns
true if valid according to Luhn algorithm, false otherwise
Examples
iex> CreditcardIdentifier.luhn("4012001037141112")
true
iex> CreditcardIdentifier.luhn("1234567890123456")
false
Check if card number is supported.
Parameters
- card_number: Credit card number as string
Returns
true if supported, false otherwise
Examples
iex> CreditcardIdentifier.supported?("4012001037141112")
true
Check if card number is supported with custom brands list.
Parameters
- card_number: Credit card number as string
- brands: List of brand data
Returns
true if supported, false otherwise
Validate CVV for a specific brand.
Parameters
- cvv: CVV code as string
- brand_or_name: Brand name (string) or brand map from find_brand
Returns
true if valid, false otherwise
Validate CVV for a specific brand with custom brands list.
Parameters
- cvv: CVV code as string
- brand_or_name: Brand name (string) or brand map from find_brand
- brands: List of brand data
Returns
true if valid, false otherwise