Skip to content

Instantly share code, notes, and snippets.

@avclark
Created December 25, 2014 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avclark/36944b81b8b26b08984c to your computer and use it in GitHub Desktop.
Save avclark/36944b81b8b26b08984c to your computer and use it in GitHub Desktop.
presale app jquery modifications
// Here are some of the changes I made to these two functions, but this broke the whole, I was getting an error saying something like unidentified param: amount, so something like that.
function populateCurrentPrice(price) {
$('.currentPrice span').text(price/100);
$('#customButton span').text(price/100);
$('#currentPurchases').text( (price/100) -1);
$('#customButton').off('click');
$('#customButton').on('click', function(e) {
handler.open({
amount: price
});
$('#currentPrice').data('locked-price', price);
e.preventDefault();
});
};
var handler = StripeCheckout.configure({
key: 'pk_live_RCFrqaPW1iuBJg1Z8mPKMiKr',
image: 'http://avclark.com/wp-content/themes/avclark/assets/images/stripe-logo.png',
name: 'Irresistible Podcasting',
panelLabel: "Pay {{amount}}",
token: function(token) {
$.get('http://nameless-plateau-8532.herokuapp.com/price.json', function(){}).done(function(data){
chargeCard(token, data.amount);
});
}
});
// So I had to change lines 25-27 to get charages to go through at all. but again, the problem here is that someone could theoretically hit the "Pay $18" button in the strip form but actually be charged $35 if that many purchases had been logged between the time the loaded the page and the time they actually checked out.
var handler = StripeCheckout.configure({
key: 'pk_live_RCFrqaPW1iuBJg1Z8mPKMiKr',
image: 'http://avclark.com/wp-content/themes/avclark/assets/images/stripe-logo.png',
name: 'Irresistible Podcasting',
panelLabel: "Pay {{amount}}",
token: function(token) {
chargeCard(token, $('#currentPrice').data('locked-price'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment