1

I've been trying to get this snippet to work: http://drumcoder.co.uk/blog/2011/aug/19/django-class-based-views/

I'm running Django on my dev machine with a port forwarded from the router to my machine.

To test that the dev server is accessible from outside my dev network, I wget http://www.myserver.com:8000/IPN from a remote server. Sure enough I get a 405 METHOD not allowed reported at the remote server end which makes sense as the script is only handling post. In the dev server logs I see:

[16/Nov/2011 02:17:09] "GET /IPN/ HTTP/1.0" 405 0

..so as far as I can tell, the URL is externally accessible.

If, however, I use the same url in the paypal sandbox I get nothing logged at all on my dev server and this message from paypal:

IPN delivery failed. Unable to connect to the specified URL. Please verify the URL and try again

What am I doing wrong? Is there any way to test this in more detail?

[Edit]

Okay, a little closer; it looks like my dev server is now hearing the response from paypal but then chucking up a code 500 internal server error:

Received Data: {u'last_name': u'Smith', u'txn_id': u'491116223', u'receiver_email': u'seller@paypalsandbox.com', u'payment_status': u'Completed', u'tax': u'2.02', u'payer_status': u'unverified', u'residence_country': u'US', u'invoice': u'abc1234', u'address_state': u'CA', u'item_name1': u'something', u'txn_type': u'cart', u'item_number1': u'AK-1234', u'quantity1': u'1', u'payment_date': u'14:03:49 Nov 16, 2011 PST', u'first_name': u'John', u'mc_shipping': u'3.02', u'address_street': u'123, any street', u'charset': u'windows-1252', u'custom': u'xyz123', u'notify_version': u'2.4', u'address_name': u'John Smith', u'address_zip': u'95131', u'test_ipn': u'1', u'receiver_id': u'TESTSELLERID1', u'payer_id': u'TESTBUYERID01', u'mc_handling1': u'1.67', u'verify_sign': u'AwL9R.WVx6Ikf1MJlP6m-Q1rVsIZASse3ZrX9.S5krSO9JhgGAQfeDuj', u'mc_handling': u'2.06', u'mc_gross_1': u'9.34', u'address_country_code': u'US', u'address_city': u'San Jose', u'address_status': u'confirmed', u'address_country': u'United States', u'mc_fee': u'0.44', u'mc_currency': u'USD', u'payer_email': u'buyer@paypalsandbox.com', u'payment_type': u'instant', u'mc_shipping1': u'1.02'}

[16/Nov/2011 22:04:01] "POST /IPN/ HTTP/1.0" 500 343

Community
  • 1
  • 1
Jon Cage
  • 36,366
  • 38
  • 137
  • 215
  • 1
    Have you tried a plain IP? Could it be a DNS issue (on paypal's end)? – Timmy O'Mahony Nov 16 '11 at 02:36
  • Hmmm... just found this: http://stackoverflow.com/questions/2838871/paypal-ipn-on-port-other-than-80 – Jon Cage Nov 16 '11 at 02:36
  • @Pasty: Nice idea. I tried that but it just gave me `IPN delivery failed. Unable to connect to the specified URL. Please verify the URL and try again.` – Jon Cage Nov 16 '11 at 02:38
  • Okay, changing to running on port 80 is at least getting the IPN to my server but now I get `IPN delivery failed. HTTP error code 403: Forbidden` – Jon Cage Nov 16 '11 at 02:50
  • One step closer.. I'd missed the bit about using `csrf_exempt` :-) – Jon Cage Nov 16 '11 at 03:02
  • 2
    Yes, IPN is only allowed on port 80 and 443. PayPal also demands a HTTP status response in the 200 range (e.g. 200 OK). – Robert Nov 16 '11 at 21:40

0 Answers0