add dynamic amount in js for stripe
This commit is contained in:
@@ -35,12 +35,21 @@ jQuery(document).ready(function($) {
|
|||||||
//email: currentForm.find('input[name="email"]').val(),
|
//email: currentForm.find('input[name="email"]').val(),
|
||||||
//amount: currentForm.find('input[name="amount"]').val() * 100,
|
//amount: currentForm.find('input[name="amount"]').val() * 100,
|
||||||
//alert($(':input[name="description"]', $stripeForm));
|
//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({
|
handler.open({
|
||||||
name: $settings.name,
|
name: $settings.name,
|
||||||
currency: "aud",
|
currency: "aud",
|
||||||
description: $(':input[name="description"]', $stripeForm).val(),
|
description: $(':input[name="description"]', $stripeForm).val(),
|
||||||
email: $(':input[name="email"]', $stripeForm).val(),
|
email: $(':input[name="email"]', $stripeForm).val(),
|
||||||
amount: $(':input[name="amount"]', $stripeForm).val() * 100,
|
amount: $amount,
|
||||||
zipCode: true,
|
zipCode: true,
|
||||||
closed: function() {
|
closed: function() {
|
||||||
//document.getElementById("booking_stripe_form").submit();
|
//document.getElementById("booking_stripe_form").submit();
|
||||||
|
Reference in New Issue
Block a user