I am using django paypal to allow users to make a payment on my site however i have a few queries.
The way how it is currently working for me is that i have a template called profile.html. When a user clicks the button "Click for more subscription options" he will be redirected to the subscriptions.html template showing a table of the subscriptions and a paypal button. When the button is clicked, the user gets redirected to another template called paypal.html which shows another paypal button derived from django-paypal's forms.py
My question here would be how i can modify the paypal view such that i can do away with the paypal.html and direct the user directly to the actual paypal website when he clicks the paypal button in subscription.html?
I hope my description of the question is clear enough.
in my views.py:
def paypal(request):
paypal_dict = {"business":settings.PAYPAL_RECEIVER_EMAIL,"amount": "1.00","item_name": "Milk" ,"invoice": "12345678", "notify_url": "%s%s" % (settings.SITE_NAME, reverse('paypal-ipn')),"return_url": "http://rosebud.mosuma.net",}
# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form.sandbox()}
return render_to_response("paypal.html", context)
in my profile.html:
....
<INPUT TYPE="submit" Value="Click to find out subscription plans" name="subscription" onClick="/subscribe/>
in my subscription.html:
<form method="post" action="paypal/">
<select name="subscription_input" id="id_subscription" style = "float: center">
<option>Monthly</option>
<option>Yearly</option>
</select></br></br>
{{ form }}
</form>
in my urls.py:
url(r'^paypal/$', 'r2.views.paypal', name='paypal'),
url(r'^profile/paypal/$', 'r2.views.paypal', name='paypal'),