forked from stripe-archive/jquery.payment
-
Notifications
You must be signed in to change notification settings - Fork 105
Credit Card CVC
Ellegonzalez edited this page Sep 21, 2016
·
3 revisions
Formats the credit card cvc:
- Limits to length of 4
- Restricts input to numbers
$('input.credit_card_cvc').formance('format_credit_card_cvc');
Validates the credit card cvc:
- Validates number length between 3 and 4
- Validates numbers
- Checks if the data attribute
credit_card_type
exists to check if cvc matches that card's standards.
$("<input value='123' />").formance('validate_credit_card_cvc'); // true
$("<input value='1234' />").formance('validate_credit_card_cvc'); // true
$("<input value='123' data-credit_card_type='amex' />").formance('validate_credit_card_cvc'); // true
$("<input value='1234' data-credit_card_type='amex' />").formance('validate_credit_card_cvc'); // true
$("<input value='12345' />").formance('validate_credit_card_cvc'); // false
Make sure to read about the credit card autocomplete recommendations.