Credit card validation in WebSphere Commerce

When an order is submitted, the CheckCCNumberCmd command is automatically called. This command checks information in the CCCHECK table to determine the validity of the credit card number. This table is empty by default and if no entry is found in the table, the basic credit card error checking command DoLuhnCheckCmd is started.

Note: To apply more rules for credit card validation, contact your credit card center and confirm the rules.

Next, you can populate the CCCHECK table. The following table provides an example data:

Table 1. Credit card: Example data
Card type Card number prefix Card number length
Visa 4xxxxxxx 13, 16
MasterCard 51xxxxx - 55xxxx 16
American Express 34xxxx, 37xxxxx 15

Assuming this example data is correct, insert the following rows into the CCCHECK table for the card types that are listed in Table 1:

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10001,'VISA',13,'4','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10002,'VISA',16,'4','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10003,'MasterCard',16,'51','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10004,'MasterCard',16,'52','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10005,'MasterCard',16,'53','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10006,'MasterCard',16,'54','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10007,'MasterCard',16,'55','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10008,'Amex',15,'34','com.ibm.commerce.payment.commands.DoLuhnCheckCmd ');

Insert into CCCHECK(CCRFNBR,CCTYPE,CCLENGTH,CCPREFIX,CCALGTASKRN)
values(-10009,'Amex',15,'37','com.ibm.commerce.payment.commands.DoLuhnCheckCmd '); 
Note:
  • For the CCTYPE column: By default, in WebSphere Commerce, the corresponding CCTYPE (cc_brand) values defined in the payment system are VISA, MasterCard, and Amex. For other card types, you might want to support (for example, Discover), the CCTYPE is based on your own definition.
  • For the CCALGTASKRN column: To perform a LUHN check after the card number is validated based on the rules given (prefix and length), you must insert com.ibm.commerce.payment.commands.DoLuhnCheckCmd as shown in this example. You can also validate the card number with your own customized command by inserting the full path of the interface of the command. If you do not need any additional validation other than the rules applied after CCLENGTH and CCPREFIX, then leave the CCALGTASKRN column blank.