Skip to content

credit_card ​

Checks that the value is a payment card number: 12–19 ASCII digits (ISO/IEC 7812) with a valid Luhn checksum.

Error codes: WRONG_CREDIT_CARD_NUMBER, FORMAT_ERROR

Live example · edit rules or inputOpen in playground
rules
input
Invaliderrors
{
  "card": "WRONG_CREDIT_CARD_NUMBER"
}

The card network is not detected. The value is checked as it is, so remove spaces and dashes before:

js
{ card: ['required', { remove: ' -' }, 'credit_card'] }