-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsignup_w_initial_promo_discount.html
executable file
·235 lines (188 loc) · 7.78 KB
/
signup_w_initial_promo_discount.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<html>
<head>
<script
src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://assets.chargeover.com/minify/?g=chargeover.js"></script>
<script>
ChargeOver.Core.setup({
'instance': 'dev.chargeover.com',
'token': 'xW6qLYeT73ouG5gVp4KQzZt28SFv1cdw'
});
</script>
<script>
// 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 + '!');
$('#form').hide();
$('#alert').show();
}
else
{
alert('An error occurred: ' + message);
}
}
$(document).ready(function () {
$('#submit').click(function() {
// 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: $('#card-holder-name').val(),
// external_key: '1234abcd1234', // Use external keys to link your app to ChargeOver data
bill_addr1: '',
bill_addr2: '',
bill_addr3: '',
bill_city: '',
bill_state: '',
bill_postcode: '',
bill_country: 'United States',
custom_1: '', // Custom field values
custom_2: '',
custom_3: ''
},
'creditcard': {
number: $('#card-number').val(),
expdate_month: $('#expiry-month').val(),
expdate_year: $('#expiry-year').val(),
name: $('#card-holder-name').val(),
// CVV/CSC card security code (used only for card validation, not stored)
cvv: $('#cvv').val()
// Optional address information (can be used for address verification)
// address: '',
// city: '',
// state: '',
// postcode: '',
// country: ''
},
'package': {
// paycycle: 'mon', // The paycycle will default to your default payment cycle, but can be specific here instead
// paycycle: 'yrl',
// paycycle: 'qtr',
// 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: $('#card-holder-name').val(),
email: $('#email-address').val(),
phone: ''
},
'_comment': 'This is a list of objects for the services to subscribe the customer to',
'line_items': [
{
'_comment': 'This is the main subscription the customer is subscribing to',
'item_id': 1
},
{
'_comment': 'This is a second line on the subscription - a discount line - that expires after 3 billing cycles (e.g. 3 months). So the discount only occurs for the first 3 months, then the discount stops.',
'item_id': 2,
'expire_recurs': 3
}
]
// ... 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: [ ... ]
};
// Call the signup method
ChargeOver.Signup.signup(my_data, my_callback_function);
});
$('#alert').hide();
});
</script>
</head>
<body>
<div class="container">
<div class="alert alert-success" id="alert">
<strong>Success!</strong> Thanks for signing up!
</div>
<form class="form-horizontal" role="form" id="form">
<h1>Signup form with an initial promotional discount</h1>
<p>
This example illustratoes a signup form where the first few months of service are given at a discounted rate.
</p>
<fieldset>
<legend>Payment</legend>
<div class="form-group">
<label class="col-sm-3 control-label" for="email-address">Email Address</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="email-address" id="email-address" placeholder="Email Address">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="card-holder-name">Name on Card</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="card-holder-name" id="card-holder-name" placeholder="Card Holder's Name">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="card-number">Card Number</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="card-number" id="card-number" placeholder="Debit/Credit Card Number">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="expiry-month">Expiration Date</label>
<div class="col-sm-9">
<div class="row">
<div class="col-xs-3">
<select class="form-control col-sm-2" name="expiry-month" id="expiry-month">
<option>Month</option>
<option value="01">Jan (01)</option>
<option value="02">Feb (02)</option>
<option value="03">Mar (03)</option>
<option value="04">Apr (04)</option>
<option value="05">May (05)</option>
<option value="06">June (06)</option>
<option value="07">July (07)</option>
<option value="08">Aug (08)</option>
<option value="09">Sep (09)</option>
<option value="10">Oct (10)</option>
<option value="11">Nov (11)</option>
<option value="12">Dec (12)</option>
</select>
</div>
<div class="col-xs-3">
<select class="form-control" name="expiry-year" id="expiry-year">
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="cvv">Card CVV</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="cvv" id="cvv" placeholder="Security Code">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button type="button" class="btn btn-success" id="submit">Pay Now</button>
</div>
</div>
</fieldset>
</form>
</div>
</body>
</html>