$(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('

Thank you for your payment! We\'ll get back to you soon.

') }) .error(function (resp) { $('section').hide() $('h1:last').after('

Something went wrong. Please contact us at whoshiring@npmjs.com.

') }) } }); $('#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(); }); })