The validation code is quite compact but well-commented; read those comments as you look at the code: dojo.provide("dojox.validate.credit Card"); /*===== dojox.validate.credit Card = ; =====*/ dojo.require("dojox.validate._base"); dojox.validate._card Info = dojox.Valid Credit Card = function(value, cc Type) dojox.Valid Credit Card Number = function(value, cc Type) dojox.Valid Cvv = function(/* String|Int */value, /* String */cc Type) You would use the code above by requiring the resource and running the is Valid Credit Card method, passing the value and card type. When visiting many tutorials demonstrating how to integrate payment gateways, or any payment service API for that matter, you will see examples of how to submit the user supplied data (which is assumed to be submitted by a form) to the payment gateway's API and how to receive the data back to tell if the transaction was approved or not. Net's sample code is a perfect example of that as are tutorials I have written myself.
With the ease of transaction and obvious convenience of credit cards comes the need to know whether a customer has enough balance to cover a purchase.
Whether you have a traditional credit card terminal, an online processing system or just a telephone, finding out if a card is valid for purchase can be done in a few moments. Swipe the customer's credit card through your credit card terminal to make a charge for the purchase. If the response is anything other than "Approved," the charge has not been made and the card is not valid for the purchase.
The merchant account provider almost always has a per transaction fee which is incurred even if a transaction is declined for any reason.
Most payment gateways include a per transaction fee as well.
Luckily the Dojo Toolkit includes , a resource capable of efficiently validating a credit card.