Example
Call the ChargeOver.Signup.signup(...)
method to sign up a new customer.
This example does not require any payment information from the customer.
// 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.
'customer': {
company: 'My Company Name, LLC',
external_key: '1234abcd1234', // Use external keys to link your app to ChargeOver data
bill_addr1: '56 Cowles Road',
bill_addr2: '',
bill_addr3: '',
bill_city: 'Mt Pleasant',
bill_state: 'MI',
bill_postcode: '48858',
bill_country: 'United States',
custom_1: '', // Custom field values
custom_2: '',
custom_3: '',
integration_map: { // Optional; used to map customers to existing other platforms
"hubspot": 12345678
}
},
'package': {
paycycle: 'mon', // The paycycle will default to your default payment cycle, but can be specific here instead
external_key: 'abcd12341234',
custom_1: '',
custom_2: '',
custom_3: '',
nickname: '', //If customers have multiple subscriptions, you can use nicknames to distinguish them
holduntil_datetime: '2015-06-01 00:00:00', // You can use this to hold/delay billing until a specific date
},
'user': {
name: 'John Doe',
email: 'test@chargeover.com',
phone: '888-924-2347'
},
coupon: '', // The coupon code to be applied to a package
'_comment': 'This is a list of hashes for the services to subscribe the customer to',
'line_items': [
{
'item_id': 1
}
]
// ... or you can refer to item external_key values instead of item_id values
// item_external_keys: [ ... ]
// ... or you can refer to item token values instead of item_id values
// item_tokens: [ ... ]
};
// 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);