Skip to content

Instantly share code, notes, and snippets.

@avclark avclark/presale app
Created Dec 25, 2014

Embed
What would you like to do?
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
You can’t perform that action at this time.