You are here

function commerce_payment_validate_credit_card_number in Commerce Core 7

Validates a credit card number using the Luhn algorithm.

Parameters

$number: The credit card number to validate.

Return value

TRUE or FALSE indicating the number's validity.

See also

http://www.merriampark.com/anatomycc.htm

1 call to commerce_payment_validate_credit_card_number()
commerce_payment_credit_card_validate in modules/payment/includes/commerce_payment.credit_card.inc
Validates a set of credit card details entered via the credit card form.

File

modules/payment/includes/commerce_payment.credit_card.inc, line 301
Credit-card helper functions for Drupal commerce.

Code

function commerce_payment_validate_credit_card_number($number) {
  $type = CommercePaymentCreditCard::detectType($number);
  if (!$type || !is_array($type)) {
    return FALSE;
  }
  return CommercePaymentCreditCard::validateNumber($number, $type);
}