Skip to main content

Example with credit card

Call the ChargeOver.Signup.signup(...) method to sign up a new customer and store credit card information securely.

// The data we want to send to ChargeOver
var my_data = {

'send_welcome_notice': true, // Default is FALSE. TRUE sends a welcome e-mail to new sign-ups, while FALSE will not send them anything.
'send_payment_receipt': true, // Default is FALSE. TRUE sends a payment receipt e-mail to new sign-ups, while FALSE will not send them anything.

'customer': {
company: 'My Company Name, LLC',

bill_addr1: '56 Cowles Road',
bill_addr2: '',
bill_addr3: '',
bill_city: 'Mt Pleasant',
bill_state: 'MI',
bill_postcode: '48858',
bill_country: 'United States',
},
'user': {
name: 'John Doe',
email: 'test@chargeover.com',
phone: '888-924-2347'
},
'creditcard': {
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: ''
},
'items': [
1 // This is the item_id value of the product you want them signed up for
]
};

// Our callback function (this gets called after data is sent to ChargeOver)
function my_callback_function(code, message, response)
{
if (code == ChargeOver.Core.CODE_OK)
{
alert('You have signed up! Thanks ' + response.user.first_name + '!');
}
else
{
alert('An error occurred: ' + message);
}
}

// Call the signup method
ChargeOver.Signup.signup(my_data, my_callback_function);