Using django-paypal IPN in Django 1.2

August 24th, 2010

If you need to use paypal in your Django project, you can use django-paypal. For project in Django 1.1, django-paypal can be used out of the box.

But in Django 1.2 you need some modification, because django-paypal IPN breaks due to CSRF.

Unfortunately, the author no longer maintain the project, you can see that from last commit date (July 15, 2009), and some unresolved issues. So here is a quick fix for using IPN in django-paypal.

In paypal.standard.ipn.views:

Change

1
2
@require_POST
def ipn(request, item_check_callable=None):

To:

1
2
3
4
5
from django.views.decorators.csrf import csrf_exempt
 
@require_POST
@csrf_exempt
def ipn(request, item_check_callable=None):

Related posts:

  1. Receiving Email Using AppEngine and Django
  2. Django Tutorial – Simple Notes Application
  3. Handling 404 Page on FeinCMS