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. <strong>Your card was declined.</strong> You have not been charged. Please try again.
</div> </div>
{% endif %} {% 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> <fieldset>
<div class="info"> <div class="info">
Subscribe for just <span>$5/mo</span>, <span>$49/yr</span>, or <span>$149 once</span>. 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> <label class="control-label" for="name">Payment plan:</label>
<div class="controls"> <div class="controls">
<select name="plan" type="text" class="input-medium" id="plan"> <select name="plan" type="text" class="input-medium" id="plan">
<option value="monthly">$5/month</option> <option value="snipt-monthly">$5/month</option>
<option value="yearly">$49/year</option> <option value="snipt-yearly">$49/year</option>
<option value="onetime">$149 once</option> <option value="onetime">$149 once</option>
</select> </select>
</div> </div>

View File

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