Skip to main content

Validate a credit card

Validating a credit card lets you determine if a given credit card number and expiration date are valid.

Example

Call the ChargeOver.CreditCard.validate(...) method to validate credit card information.


var my_data = {
number: '4111 1111 1111 1111',
expdate_month: 7,
expdate_year: 2016,
name: 'John D Doe'

// CVV/CSC card security code (used only for card validation, not stored)
// cvv: '',

// Optional address information (can be used for address verification)
// address: '',
// city: '',
// state: '',
// postcode: '',
// country: ''
};

function my_callback_function(code, message, response)
{
if (code == 200)
{
alert('Valid!');
}
else
{
alert('Not valid!');
}
};

ChargeOver.CreditCard.validate(my_data, my_callback_function);