Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
For those who aren't using coffeescript, here is the compiled Subscriptions javascript file from RailsCast #288 Billing with Stripe
(function() {
var subscription;
jQuery(function() {
return subscription.setupForm();
subscription = {
setupForm: function() {
return $('#new_subscription').submit(function() {
$('input[type=submit]').attr('disabled', true);
if ($('#card_number').length) {
return false;
} else {
return true;
processCard: function() {
var card;
card = {
number: $('#card_number').val(),
cvc: $('#card_code').val(),
expMonth: $('#card_month').val(),
expYear: $('#card_year').val()
return Stripe.createToken(card, subscription.handleStripeResponse);
handleStripeResponse: function(status, response) {
if (status === 200) {
return $('#new_subscription')[0].submit();
} else {
return $('input[type=submit]').attr('disabled', false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.