diff --git a/booking.stripe.js b/booking.stripe.js index c6e2816..8d92b04 100644 --- a/booking.stripe.js +++ b/booking.stripe.js @@ -35,12 +35,21 @@ jQuery(document).ready(function($) { //email: currentForm.find('input[name="email"]').val(), //amount: currentForm.find('input[name="amount"]').val() * 100, //alert($(':input[name="description"]', $stripeForm)); + + //set the amount dynamically based on the card brand from the token + if ($(':input[name="card_brand"]', $stripeForm).val() == 'American Express') { + var $amount = $(':input[name="foreign_gross_amount"]', $stripeForm).val() * 100; + } + else { + var $amount = $(':input[name="gross_amount"]', $stripeForm).val() * 100; + } + handler.open({ name: $settings.name, currency: "aud", description: $(':input[name="description"]', $stripeForm).val(), email: $(':input[name="email"]', $stripeForm).val(), - amount: $(':input[name="amount"]', $stripeForm).val() * 100, + amount: $amount, zipCode: true, closed: function() { //document.getElementById("booking_stripe_form").submit();