payment: note that Stripe has instituted an additional 1% fee for non-US cards
[hcoop/portal.git] / payment.mlt
index 4a7aea8..2394d46 100644 (file)
@@ -17,11 +17,17 @@ days.</p>
 <script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
 <script src="https://checkout.stripe.com/checkout.js"></script>
 
-<p>Remember that we credit member balances for payments <b>after subtracting service fees</b>. This means that, to increase your balance by a particular amount, you must make a <b>larger</b> payment than just that amount.</p>
+<p>Remember that we credit member balances for payments <b>after subtracting service fees</b>. This means that, to increase your balance by a particular amount, you must make a <b>larger</b> payment
+than just that amount. Stripe and Paypal have equal fees (for US
+residents); You can calculate the amount <em>x</em> to send from the amount <em>y</em> you want us to receive with this formula: <tt><em>x</em> = (<em>y</em> +
+  0.30) / (1 - 0.029)</tt>. Stripe charges an additional 1% fee for non-U.S. cards, even when paying in USD.</p>
 
+<div class="payment-tile">
 <h4>Add to your balance with <a href="https://paypal.com">PayPal</a></h4>
 
-<p>You should consult <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_display-fees-outside">the PayPal fees page</a> to figure out how much extra to send. We have a business account, which means, for example, a 2.9% plus 30 cent fee for payments from the USA. This means that you can calculate the amount <em>x</em> to send from the amount <em>y</em> you want us to receive with this formula: <em>x</em> = (<em>y</em> + .3) / (1 - .029). The fees may be different for other countries.</p>
+<p>Payal fees are 2.9% + $0.30 for payments from the US. The fees for
+other countries may be different, consult <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_display-fees-outside">the PayPal fees page</a> if
+  needed.</p>
 
 <form method="GET" action="https://www.paypal.com/cgi-bin/webscr">
   <input type="hidden" name="cmd" value="_xclick" />
@@ -41,17 +47,18 @@ days.</p>
    });
   </script>
 
-  <label>$<input id="paypalDues" type="text" name="amount" pattern="^\\d+\\.\\d\\d$" required="required" size="7" /></label>
+  <label>$<input id="paypalDues" type="text" name="amount" pattern="^\\d+(\\.\\d\\d)?$" required="required" size="7" /></label>
   <input type="submit" value="Add To Balance" />
 </form>
 
 <% switch #paypal you of
    NONE => %><p>You haven't set a PayPal e-mail address.  If you are going to send a payment by PayPal, please <a href="pref">set a PayPal e-mail address on the Preferences page</a> first to ensure that you are credited promptly and accurately.</p><%
 end %>
-
+</div>
+<div class="payment-tile">
 <h4>Add to your balance with <a href="https://stripe.com/">Stripe</a></h4>
 
-<p>Stripe fees are $0.30 + 2.9% for each transaction regardless of country.</p>
+<p>Stripe fees are 2.9% + $0.30 for each transaction regardless of country.</p>
 
 <form id="stripeForm" action="/stripe/stripe-payment.cgi" method="POST">
   <select id="stripeDuesEasy">
@@ -66,9 +73,11 @@ end %>
      $("#stripeDues").val ($(this).val ());
    });
   </script>
-  <label>$<input type="text" name="stripeDues" id="stripeDues" pattern="^\\d+\\.\\d\\d$" required="required" size="7" /></label>
+  <label>$<input type="text" name="stripeDuesUSD" id="stripeDues" pattern="^\\d+(\\.\\d\\d)?$" required="required" size="7" /></label>
   <input type="hidden" name="webuser_id" value="<% #id you %>" />
   <input type="hidden" name="webuser_name" value="<% #name you %>" />
+  <input type="hidden" name="cmd" value="member_payment" />
+  <input type="hidden" name="stripeDues" id="stripeDuesCents" value="" />
   
   <button id="stripePay">Add To Balance</button>
   <script>
@@ -76,17 +85,17 @@ end %>
      if ($("#stripeDues")[0].validity.valid) { 
        var token = function(res){
         var $input = $('<input type=hidden name=stripeToken />').val(res.id);
-        $("#stripeDues").val($("#stripeDues").val() * 100);
+        $("#stripeDuesCents").val($("#stripeDues").val() * 100);
         $('#stripeForm').append($input).submit();
        };
        
        // Open Checkout with further options
        StripeCheckout.open({
-        key: 'pk_test_sJkMs1I4fVK4JQu9QkFDjOMs',
+        key: 'pk_live_pvWpH450opRXCi0KvN1h5mN1',
         image: '/globe.gif',
         name: 'Hcoop',
-        description: 'Dues',
-        amount:  ($("#stripeDues").val() * 100),
+        description: 'Dues ($'.concat ($("#stripeDues").val ()).concat (')'),
+        amount:  $("#stripeDues").val() * 100,
         currency: 'usd',
         address: true,
         panelLabel: 'Pay {{amount}}',
@@ -97,4 +106,4 @@ end %>
    });
   </script>
 </form>
-
+</div>