NAME

ValidCreditCard - verify that a credit card number is valid and not expired

SYNOPSIS

use ValidCreditCard;
ValidCreditCard CreditCardType CreditCardNumber ExpirationDate

DESCRIPTION

CreditCardType is a string starting with one the following characters: A(merican Express), D(iscover), M(astercard), or V(isa). Lower case is acceptable. Any characters after the first are ignored.

CreditCardNumber is a 13-16 digit number with or without embedded spaces. It will be assembled from chunks of numbers that dont include a / or a -.

Expiration date is string of the form MM/YY, where MM is a one or two digit string representing the month, and YY is a 1-4 digit string representing the year. Years 00-70 are assumed to be years 20xx, and years 71-99 are assumed to be years 19xx.

ValidCardCard returns 1 if valid, 0 otherwise. A credit card is valid if it passes a checksum algorithm and is not expired. It does not determine if the card has been issued, that the credit limit has not been exceeded, etc.

AUTHOR

Bruce Albrecht (bruce@zuhause.mn.org)