payment: note that Stripe has instituted an additional 1% fee for non-US cards
[hcoop/portal.git] / payment.mlt
CommitLineData
d5f8418b
AC
1<% val you = Init.getUser () %>
2
f8b39e09
CE
3<% if $"cmd" = "stripeSuccess" then %>
4<div class="notice">
5
6<h3>Stripe Payment Succeeded</h3>
7
8<p>Your payment via Stripe must still be applied to your balance
9manually at present, and will be applied by the treasurer within a few
10days.</p>
11
12</div>
13<% end %>
14
15<h3>Add To Your Balance</h3>
16
17<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
18<script src="https://checkout.stripe.com/checkout.js"></script>
19
aaba877a
CE
20<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
21than just that amount. Stripe and Paypal have equal fees (for US
22residents); 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> +
8c971d48 23 0.30) / (1 - 0.029)</tt>. Stripe charges an additional 1% fee for non-U.S. cards, even when paying in USD.</p>
f8b39e09 24
aaba877a 25<div class="payment-tile">
f8b39e09
CE
26<h4>Add to your balance with <a href="https://paypal.com">PayPal</a></h4>
27
aaba877a
CE
28<p>Payal fees are 2.9% + $0.30 for payments from the US. The fees for
29other 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
30 needed.</p>
f8b39e09
CE
31
32<form method="GET" action="https://www.paypal.com/cgi-bin/webscr">
33 <input type="hidden" name="cmd" value="_xclick" />
34 <input type="hidden" name="business" value="payment@hcoop.net" />
35 <input type="hidden" name="item_name" value="Member payment for <% Init.getUserName () %>" />
36
37 <select id="paypalDuesEasy">
10e55875 38 <option value="" selected="selected">Custom:</option>
f8b39e09
CE
39 <% foreach (amt) in [10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100] do %>
40 <option value="<% amt %>.00">$<% amt %>.00</option>
41 <% end %>
42 </select>
43
44 <script>
45 $("#paypalDuesEasy").change (function () {
46 $("#paypalDues").val ($(this).val ());
47 });
48 </script>
49
4d4f99b5 50 <label>$<input id="paypalDues" type="text" name="amount" pattern="^\\d+(\\.\\d\\d)?$" required="required" size="7" /></label>
10e55875 51 <input type="submit" value="Add To Balance" />
f8b39e09 52</form>
ab0b905b 53
d5f8418b
AC
54<% switch #paypal you of
55 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><%
56end %>
aaba877a
CE
57</div>
58<div class="payment-tile">
f8b39e09
CE
59<h4>Add to your balance with <a href="https://stripe.com/">Stripe</a></h4>
60
aaba877a 61<p>Stripe fees are 2.9% + $0.30 for each transaction regardless of country.</p>
f8b39e09
CE
62
63<form id="stripeForm" action="/stripe/stripe-payment.cgi" method="POST">
64 <select id="stripeDuesEasy">
10e55875 65 <option value="" selected="selected">Custom:</option>
f8b39e09
CE
66 <% foreach (amt) in [10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100] do %>
67 <option value="<% amt %>.00">$<% amt %>.00</option>
68 <% end %>
69 </select>
70
71 <script>
72 $("#stripeDuesEasy").change (function () {
73 $("#stripeDues").val ($(this).val ());
74 });
75 </script>
4d4f99b5 76 <label>$<input type="text" name="stripeDuesUSD" id="stripeDues" pattern="^\\d+(\\.\\d\\d)?$" required="required" size="7" /></label>
f8b39e09
CE
77 <input type="hidden" name="webuser_id" value="<% #id you %>" />
78 <input type="hidden" name="webuser_name" value="<% #name you %>" />
e4964ef9 79 <input type="hidden" name="cmd" value="member_payment" />
2f55e71d 80 <input type="hidden" name="stripeDues" id="stripeDuesCents" value="" />
f8b39e09 81
10e55875 82 <button id="stripePay">Add To Balance</button>
f8b39e09
CE
83 <script>
84 $("#stripePay").click (function(e) {
85 if ($("#stripeDues")[0].validity.valid) {
86 var token = function(res){
87 var $input = $('<input type=hidden name=stripeToken />').val(res.id);
2f55e71d 88 $("#stripeDuesCents").val($("#stripeDues").val() * 100);
f8b39e09
CE
89 $('#stripeForm').append($input).submit();
90 };
91
92 // Open Checkout with further options
93 StripeCheckout.open({
11dfa3cd 94 key: 'pk_live_pvWpH450opRXCi0KvN1h5mN1',
f8b39e09
CE
95 image: '/globe.gif',
96 name: 'Hcoop',
e90560c0 97 description: 'Dues ($'.concat ($("#stripeDues").val ()).concat (')'),
2f55e71d 98 amount: $("#stripeDues").val() * 100,
f8b39e09
CE
99 currency: 'usd',
100 address: true,
101 panelLabel: 'Pay {{amount}}',
102 token: token
103 });
104 }
105 return false;
106 });
107 </script>
108</form>
aaba877a 109</div>