CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

Check CC Number Errors (tag pair)

check_cc_number_errors validates a credit card number (and optional card type) and returns validation result variables.

This is a legacy validation helper tag pair.

See also:

Parameters

credit_card_number

Credit card number to validate.

credit_card_number="4111111111111111"

card_type

Optional expected card type/brand used in validation.

card_type="visa"

Variables

  • valid (true/false style output)
  • errors (empty string when valid, localized error message when invalid)

Behavior and Constraints

  1. Initializes output as valid = true, errors = ''.
  2. If credit_card_number is missing, sets missing-number error message.
  3. Runs validate_credit_card(credit_card_number, card_type).
  4. If invalid, maps error codes to localized messages:
    • unknown card type
    • card type mismatch
    • invalid card number
    • incorrect card length
    • fallback unknown-type message
  5. Returns parsed variables row.

Examples

Basic validation output:

{exp:cartthrob:check_cc_number_errors credit_card_number="4111111111111111" card_type="visa"}
    Valid: {valid}<br>
    Error: {errors}
{/exp:cartthrob:check_cc_number_errors}

Display only when invalid:

{exp:cartthrob:check_cc_number_errors credit_card_number="{credit_card_number}" card_type="{card_type}"}
    {if errors}
        <p class="error">{errors}</p>
    {/if}
{/exp:cartthrob:check_cc_number_errors}