-<% val you = Init.getUser () %>
-
-<h3><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=payment@hcoop.net&item_name=Member+payment+for+<% Init.getUserName () %>">Add to your balance with PayPal</a></h3>
-
-<% 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 %>
-
-<p>Remember that we credit member balances for PayPal payments <b>after subtracting PayPal's 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. 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 <i>x</i> to send from the amount <i>y</i> you want us to receive with this formula: <i>x</i> = (<i>y</i> + .3) / (1 - .029). The fees may be different for other countries.</p>
-
-<h3>Add to your balance with <a href="http://checkout.google.com/">Google Checkout</a>:
-
-<table>
-<form action="https://checkout.google.com/cws/v2/Merchant/641723647067155/checkoutForm" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm">
- <tr>
- <td>
- <select name="item_selection_1">
- <option value="1">$10.00 - Add $10 to your balance</option>
- <option value="2">$20.00 - Add $20 to your balance</option>
- <option value="3">$30.00 - Add $30 to your balance</option>
- <option value="4">$40.00 - Add $40 to your balance</option>
- <option value="5">$50.00 - Add $50 to your balance</option>
- <option value="6">$100.00 - Add $100 to your balance</option>
- <option value="7">$200.00 - Add $200 to your balance</option>
- <option value="8">$500.00 - Add $500 to your balance</option>
- </select>
- <input name="item_option_name_1" type="hidden" value="Add $10 to your balance"/>
- <input name="item_option_price_1" type="hidden" value="10.0"/>
- <input name="item_option_description_1" type="hidden" value=""/>
- <input name="item_option_quantity_1" type="hidden" value="1"/>
- <input name="item_option_currency_1" type="hidden" value="USD"/>
- <input name="item_option_name_2" type="hidden" value="Add $20 to your balance"/>
- <input name="item_option_price_2" type="hidden" value="20.0"/>
- <input name="item_option_description_2" type="hidden" value=""/>
- <input name="item_option_quantity_2" type="hidden" value="1"/>
- <input name="item_option_currency_2" type="hidden" value="USD"/>
- <input name="item_option_name_3" type="hidden" value="Add $30 to your balance"/>
- <input name="item_option_price_3" type="hidden" value="30.0"/>
- <input name="item_option_description_3" type="hidden" value=""/>
- <input name="item_option_quantity_3" type="hidden" value="1"/>
- <input name="item_option_currency_3" type="hidden" value="USD"/>
- <input name="item_option_name_4" type="hidden" value="Add $40 to your balance"/>
- <input name="item_option_price_4" type="hidden" value="40.0"/>
- <input name="item_option_description_4" type="hidden" value=""/>
- <input name="item_option_quantity_4" type="hidden" value="1"/>
- <input name="item_option_currency_4" type="hidden" value="USD"/>
- <input name="item_option_name_5" type="hidden" value="Add $50 to your balance"/>
- <input name="item_option_price_5" type="hidden" value="50.0"/>
- <input name="item_option_description_5" type="hidden" value=""/>
- <input name="item_option_quantity_5" type="hidden" value="1"/>
- <input name="item_option_currency_5" type="hidden" value="USD"/>
- <input name="item_option_name_6" type="hidden" value="Add $100 to your balance"/>
- <input name="item_option_price_6" type="hidden" value="100.0"/>
- <input name="item_option_description_6" type="hidden" value=""/>
- <input name="item_option_quantity_6" type="hidden" value="1"/>
- <input name="item_option_currency_6" type="hidden" value="USD"/>
- <input name="item_option_name_7" type="hidden" value="Add $200 to your balance"/>
- <input name="item_option_price_7" type="hidden" value="200.0"/>
- <input name="item_option_description_7" type="hidden" value=""/>
- <input name="item_option_quantity_7" type="hidden" value="1"/>
- <input name="item_option_currency_7" type="hidden" value="USD"/>
- <input name="item_option_name_8" type="hidden" value="Add $500 to your balance"/>
- <input name="item_option_price_8" type="hidden" value="500.0"/>
- <input name="item_option_description_8" type="hidden" value=""/>
- <input name="item_option_quantity_8" type="hidden" value="1"/>
- <input name="item_option_currency_8" type="hidden" value="USD"/>
- </td>
- <td>
- <input alt="" src="https://checkout.google.com/buttons/buy.gif?merchant_id=641723647067155&w=117&h=48&style=white&variant=text&loc=en_US" type="image"/>
- </td>
- </tr>
- </form>
- </table>
-</h3>
-
-<% switch #checkout you of
- NONE => %><p>You haven't set a Google Checkout e-mail address. If you are going to send a payment by Google Checkout, please <a href="pref">set a Checkout e-mail address on the Preferences page</a> first to ensure that you are credited promptly and accurately.</p><%
-end %>
-
-<p>Remember that we credit member balances for Checkout payments <b>after subtracting <a href="https://checkout.google.com/seller/fees.html">Checkout's service fees</a></b>. This means that, to increase your balance by a particular amount, you must make a <b>larger</b> payment than just that amount. The current fees are 2% plus 20 cents. This means that you can calculate the amount <i>x</i> to send from the amount <i>y</i> you want us to receive with this formula: <i>x</i> = (<i>y</i> + .2) / (1 - .02).</p>
-
-<p>Checkout has an "e-mail anonymizing" feature, where recipients of your payments will only see your e-mail address as some random string at checkout.google.com. If you use this feature, you must e-mail <a href="mailto:payment@hcoop.net">payment@hcoop.net</a> after every Checkout payment, letting us know which HCoop user the payment is meant for. <b>If you use Checkout's e-mail anonymizing and don't send us an e-mail with your payment, we may not credit you for the payment.</b></p>
+<% val you = Init.getUser () %>
+
+<% if $"cmd" = "stripeSuccess" then %>
+<div class="notice">
+
+<h3>Stripe Payment Succeeded</h3>
+
+<p>Your payment via Stripe must still be applied to your balance
+manually at present, and will be applied by the treasurer within a few
+days.</p>
+
+</div>
+<% end %>
+
+<h3>Add To Your Balance</h3>
+
+<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>
+
+<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>
+
+<form method="GET" action="https://www.paypal.com/cgi-bin/webscr">
+ <input type="hidden" name="cmd" value="_xclick" />
+ <input type="hidden" name="business" value="payment@hcoop.net" />
+ <input type="hidden" name="item_name" value="Member payment for <% Init.getUserName () %>" />
+
+ <select id="paypalDuesEasy">
+ <option value="" selected="selected">---</option>
+ <% foreach (amt) in [10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100] do %>
+ <option value="<% amt %>.00">$<% amt %>.00</option>
+ <% end %>
+ </select>
+
+ <script>
+ $("#paypalDuesEasy").change (function () {
+ $("#paypalDues").val ($(this).val ());
+ });
+ </script>
+
+ <label>$<input id="paypalDues" type="text" name="amount" pattern="^\\d+\\.\\d\\d$" /></label>
+ <input type="submit" value="Add to Your Balance With Paypal" />
+</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 %>
+
+<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>
+
+<form id="stripeForm" action="/stripe/stripe-payment.cgi" method="POST">
+ <select id="stripeDuesEasy">
+ <option value="" selected="selected">---</option>
+ <% foreach (amt) in [10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100] do %>
+ <option value="<% amt %>.00">$<% amt %>.00</option>
+ <% end %>
+ </select>
+
+ <script>
+ $("#stripeDuesEasy").change (function () {
+ $("#stripeDues").val ($(this).val ());
+ });
+ </script>
+ <label>$<input type="text" name="stripeDues" id="stripeDues" pattern="^\\d+\\.\\d\\d$"/></label>
+ <input type="hidden" name="webuser_id" value="<% #id you %>" />
+ <input type="hidden" name="webuser_name" value="<% #name you %>" />
+
+ <button id="stripePay">Add To Your Balance With Stripe</button>
+
+ <script>
+ $("#stripePay").click (function(e) {
+ if ($("#stripeDues")[0].validity.valid) {
+ var token = function(res){
+ var $input = $('<input type=hidden name=stripeToken />').val(res.id);
+ $("#stripeDues").val($("#stripeDues").val() * 100);
+ $('#stripeForm').append($input).submit();
+ };
+
+ // Open Checkout with further options
+ StripeCheckout.open({
+ key: 'pk_test_sJkMs1I4fVK4JQu9QkFDjOMs',
+ image: '/globe.gif',
+ name: 'Hcoop',
+ description: 'Dues',
+ amount: ($("#stripeDues").val() * 100),
+ currency: 'usd',
+ address: true,
+ panelLabel: 'Pay {{amount}}',
+ token: token
+ });
+ }
+ return false;
+ });
+ </script>
+</form>
+