ValidateCard Method
Checks the card number and expiration date for validity.
Syntax
cardvalidator.validateCard([callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This method performs several checks on customer information to determine if the card information submitted could be valid. This should be done before submitting an actual transaction for authorization. The tests performed are listed below:
Luhn Digit Check | This process checks the digits of the CardNumber to make sure that it could be a valid card number. The mathematical algorithm used to determine validity is outlined in the Visa External Interface Specification: Authorization Record Formats Version 5.8, page 63. |
Card Type Check | This process checks the length and the beginning digits of the CardNumber to determine if it is a valid card type. The results of this check is stored are the CardType and CardTypeDescription properties. |
Expiration Date Check | The date given in CardExpMonth and CardExpYear is compared to the current system date to make sure that the card is still valid. |