Update Stripe data-amount
Turns out that to have a dynamic data-amount for the stripe payment, you have to use Custom Checkout instead of Simple Checkout. This code did the trick.
<button class="btn btn-primary btn-lg" id="stripe-button">
Checkout <span class="glyphicon glyphicon-shopping-cart"></span>
</button>
<script>
$('#stripe-button').click(function(){
var token = function(res){
var $id = $('<input type=hidden name=stripeToken />').val(res.id);
var $email = $('<input type=hidden name=stripeEmail />').val(res.email);
$('form').append($id).append($email).submit();
};
var amount = $("#stripeAmount").val();
StripeCheckout.open({
key: '{{ STRIPE_PUBLIC_KEY }}',
amount: amount,
name: 'Serendipity Artisan Blends',
image: '{% static "img/marketplace.png" %}',
description: 'Purchase Products',
panelLabel: 'Checkout',
token: token
});
return false;
});
</script>
OR you can just use the following code before clicking the stripe button ;-)
StripeCheckout.__app.configurations.button0.amount = 1234;
$('#stripe-button').click();