Support custom plans via URL.

master
Nick Sergeant 2014-05-30 14:30:35 -04:00
parent 2074bf0329
commit 9a6633bbd1
2 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@
<strong>Your card was declined.</strong> You have not been charged. Please try again.
</div>
{% endif %}
<form class="form-horizontal static-box" id="pro-signup" method="post" action="/pro/complete/">
<form class="form-horizontal static-box" id="pro-signup" method="post" action="/pro/complete/{% if 'plan' in request.GET %}?plan={{ request.GET.plan }}{% endif %}">
<fieldset>
<div class="info">
Subscribe for just <span>$5/mo</span>, <span>$49/yr</span>, or <span>$149 once</span>.
@ -49,8 +49,8 @@
<label class="control-label" for="name">Payment plan:</label>
<div class="controls">
<select name="plan" type="text" class="input-medium" id="plan">
<option value="monthly">$5/month</option>
<option value="yearly">$49/year</option>
<option value="snipt-monthly">$5/month</option>
<option value="snipt-yearly">$49/year</option>
<option value="onetime">$149 once</option>
</select>
</div>

View File

@ -119,10 +119,10 @@ def pro_complete(request):
# Recurring plans.
else:
if request.POST['plan'] == 'monthly':
plan = 'snipt-monthly'
elif request.POST['plan'] == 'yearly':
plan = 'snipt-yearly'
if 'plan' in request.GET:
plan = request.GET['plan']
else:
plan = request.POST['plan']
try:
customer = stripe.Customer.create(card=token,