diff --git a/hosting/static/hosting/js/payment.js b/hosting/static/hosting/js/payment.js index dc4023e8..af9a9e71 100644 --- a/hosting/static/hosting/js/payment.js +++ b/hosting/static/hosting/js/payment.js @@ -1,10 +1,7 @@ $( document ).ready(function() { - var stripe = Stripe(window.stripeKey); - var elements = stripe.elements({locale: window.current_lan}); - var card = elements.create('card', options={hidePostalCode: true}); - card.mount('#card-element'); + $.ajaxSetup({ beforeSend: function(xhr, settings) { @@ -32,6 +29,12 @@ $( document ).ready(function() { var hasCreditcard = window.hasCreditcard || false; + if (!hasCreditcard){ + var stripe = Stripe(window.stripeKey); + var elements = stripe.elements({locale: window.current_lan}); + var card = elements.create('card', options={hidePostalCode: true}); + card.mount('#card-element'); + } console.log("has creditcard", hasCreditcard); // hasCreditcard= true; diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index 0badfa0f..b6af6f5f 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -57,9 +57,11 @@