File size: 1,651 Bytes
e1d589b | 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 | $(document).ready(function () {
var amount
var paymentEndpoint
var handler = StripeCheckout.configure({
key: $('input[type=hidden]').data('key'),
image: '/static/img/logos/n-64.png',
token: function(token, args) {
token.amount = amount
$.ajax({
url: paymentEndpoint
, data: JSON.stringify(token)
, type: 'POST'
})
.done(function (resp) {
$('section').hide()
$('h1:last').after('<h2 style="color: green;">Thank you for your payment! We\'ll get back to you soon.</h2>')
})
.error(function (resp) {
$('section').hide()
$('h1:last').after('<h2 style="color: red;">Something went wrong. Please contact us at <a href="mailto:whoshiring@npmjs.com">whoshiring@npmjs.com</a>.</h2>')
})
}
});
$('#one-month').click(function (e) {
amount = 35000;
paymentEndpoint = '/joinwhoshiring'
handler.open({
name: 'npm, Inc.',
description: "Pay $350 for 1 month of advertising",
amount: amount
});
e.preventDefault();
});
$('#three-months').click(function (e) {
amount = 100000
paymentEndpoint = '/joinwhoshiring'
handler.open({
name: 'npm, Inc.',
description: "Pay $1000 for 3 months of advertising",
amount: amount
});
e.preventDefault();
});
$('#starter-pack').click(function (e) {
paymentEndpoint = '/enterprise/starter'
handler.open({
name: 'npm, Inc.',
description: "Enterprise Starter License, $25/month",
allowRememberMe: false,
panelLabel: "Subscribe",
amount: amount
});
e.preventDefault();
});
})
|