Reputation: 190
My settings.py
is:
INSTALLED_APPS = (
.......,
'paypal.standard.ipn',
)
PAYPAL_RECEIVER_EMAIL = "[email protected]"
PAYPAL_TEST = True
My views.py
is:
@csrf_exempt
def pricing(request):
paypal_dict_flexible = {
"business": "[email protected]",
"amount": "100.00",
"item_name": "Flexible Subscription",
"invoice": "10",
"notify_url": "https://example.com/notify",
"return_url": "http://example.com/signup",
"cancel_return": "",
}
form = PayPalPaymentsForm(initial=paypal_dict_flexible)
context = {"form": form, 'current_page': 'pricing'}
return render_to_response("leavebuddyapp/pricing.html", context)
@csrf_exempt
def notify(request):
return HttpResponse("Notify called")
My urls.py
is:
urlpatterns = patterns('',
#Paypal
(r'^notify', include('paypal.standard.ipn.urls')),
)
My template is:
<div class="test">
{{ form.render }}
<a href="/signup/flexible" class="btn">Buy now</a>
</div>
My problem is that the function "notify
" in the views.py
is not being called. Can you guys please guide me into the right direction. I am not getting what I am doing wrong.
Thanks in advance.
Upvotes: 1
Views: 1181
Reputation: 1317
As per the documentation, you have correctly added following line in urls.py
(r'^notify', include('paypal.standard.ipn.urls')),
Above code snippets means that https://example.com/notify
url directly call the paypal pacakge views ipn funcation, which is actually designed for handling the ipn response.
So @Shivratna you don't need to implement any other notify
function in your views.
Can you make sure following things are done, before you do the paypal transaction:
like paypal_dict_flexible
python manage.py syncdb
which creates tables for django-paypal packageI hope my suggestion will show you right direction ;)
Upvotes: 2
Reputation: 53679
I don't know why you think that the /notify
url should call your view. Your url configuration points your /notify
url to the paypal.standard.ipn.views.ipn
view by including the paypal url configuration.
If you want to call your notify
view, you should include it in your url configuration:
urlpatterns = patterns('',
...
(r'^notify/$', myapp.views.notify),
)
However, I highly doubt you'd want to write your own view for the paypal ipn callback. Django-paypal's default ipn view includes signal hooks where you can easily add your own custom logic.
Upvotes: 0