Credit Card Validation Utilities

Two utilities are included in the ATS API account that allow you to check the validity of credit card numbers.

These utilities use the CardType file for calculation parameters.

The algorithm used in these utilities is the Luhn formula.

CC.CardType File

Contains various credit card type information.

Attribute

Dict Item

Description

0

CardTypeID

Card type ID. This is the abbreviated card name with no spaces. This name is used in the JavaScript as variable names.

1

Name

Name of card.

2

Prefix

Prefix identifier of the card. The prefix identifies the type of card. For example, a card number starting with a 4 is a Visa card.

This entry is MultiValued.

3

Length

Length of card number. The length indicates the number of digits a card can have, depending on its type. The length does not include the spaces between the numbers.

4

Order

Card processing order for validation calculation. The processing order can be important in some cases.

JavaScript Utility

The JavaScript utility checks the validity of the card number, card type, and expiration date.

In order to use the script, you must include the JavaScript from the CC.Validation template in your HTML file and insert the proper replacement strings in the different sections. Additionally, you must call the CheckCardNumber function from your submit button. For example:

<input type="button" value="submit" OnClick="CheckCardNumber(this.form)">

The CheckCardNumber function submits the form using this script:

document.forms["#FormName#"].submit();

where #FormName# is the name of your form.

JavaScript is automatically inserted in the HTML page by the w3HTMLeComCCInfo subroutine if the PreCCcheck flag is set to 1.

CC.Check - Pick BASIC Utility

The Pick BASIC subroutine checks the card numbers and returns the card type. It does not check the expiration date.

Parameters

In

Card.No

Card number without spaces or hyphens.

Out

Result

Returns 1 if the card is valid. If the card is not valid, returns the reason.

CardType

Returns the card type

Att1: Card Type ID

Att2: Card Type Name

Basic Call

Call CC.Check(MyCardNumber,Result,CardType)

The subroutine uses the file CardType described above to do its calculation.