Skip to main content

Tokenizing a credit card

Tokenizing a credit card securely stores a credit card within ChargeOver.

Example

Call the ChargeOver.CreditCard.tokenize(...) method to store a credit card.

The default behavior is to update all packages for this customer to use this newly tokenized credit card for future payments. If you do not want this behavior, you can specify use_as_default_paymethod=false.

var my_data = {
customer_external_key: '110051',
// customer_token: 'e64f6121a3cdfb8424413cce74f201e2',

// use_as_default_paymethod: true,

number: '4111 1111 1111 1111',
expdate_month: 7,
expdate_year: 2015,
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('We stored/tokenized credit card ' + response.creditcard.mask_number);
}
else
{
alert('Error: ' + message);
}
}

ChargeOver.CreditCard.tokenize(my_data, my_callback_function);