2👍
I was stuck on this problem for a very long time! Turns out I had an error in my signals code but the error was never displayed, just appeared as though the signal was not being called. Eventually tracked it down by modifying the code in paypal-django like this:
in paypal.standard.ipn.views.py – 3 lines from the bottom:
try:
ipn_obj.verify(item_check_callable)
except:
import sys, traceback
traceback.print_exc(file=sys.stdout)
Then check the apache error log for any errors.
4👍
Regarding your third point, as Daniel says in the answer to the question you linked, you need to allow Paypal to POST to your local machine. That means you need to open the port 80 on your router and forward the request to your development machine on port 8000. Go to http://whatismyip.com, get the IP and try to access it in your browser. Unless you have your router configured correctly you’ll get nothing.
Once you’ve got your router set up you’ll need to run the django server with:
python manage.py runserver 0.0.0.0:8000
Then you’ll be able to access it externally. You can test this by putting your Internet connection’s IP into the browser – you should see your Django site. If you don’t then Paypal can’t ‘see’ you either and will never be able to post back.
- [Django]-Specifying Django Query Filters at Run Time
- [Django]-Django EmailMultiAlternatives sending to multiple "to" addresses
- [Django]-Django test the correct template used: with self.assertTemplateUsed()
0👍
For #1 — The only place I needed to put the @csrf_exempt tag was on the view that is called by the return_url. PayPal actually posts a lot of data about the payment to this url as well, for whatever reason.
For #2 — You can specify a “custom” field in the paypal_dict, which will then be passed back to the notify_url. If you’re only selling from one url or endpoint, it will be obvious what the payment is for, in combination with the invoice you have specified. But you might want to provide an additional field here to work with. “Upgrade all users!” is just a random example that the django-paypal documentation has.
For #3 — I used ngrok, as mentioned in the django-paypal docs now (http://django-paypal.readthedocs.org/en/stable/standard/ipn.html#testing). I found it pretty easy to set up, not knowing anything about the tool before-hand.
Additionally — one gotcha on the postbacks that nailed me for awhile was the following: I believed that PayPal was not posting to my notify_url, and I was researching answers like this.
Eventually I realized that PayPal was actually posting to my notify_url, but that my local machine was using an old version of SSL which would not complete a handshake when posting back to the PayPal sandbox (to get the VERIFIED/INVALID result). My version was 0.9.8 and they need something 1.0 or above. To make a long story short, the notify_url is a multi-step process and the problem could be something besides PayPal making the initial post to the notify_url.