Search code examples
pythonpaypalpaypal-ipnpaypal-sandbox

Sandbox Paypal IPN not sending response, works fine with live site Paypal


This problem just recently appeared: I can't get a response from paypal sandbox (IPN).

I use the following code:

import requests
params = {} #all params paypal sent via IPN, empty here for sake of brevity
params['cmd'] = "_notify-validate"
r = requests.post("https://www.sandbox.paypal.com/cgi-bin/webscr", params = params)

This returns an error message saying "Connection reset by peer"

Note that this code was working fine before, and if I use the live site Paypal URL instead of sandbox, then I still get a response instead of a connection error.

Can anyone verify if this is a problem on Paypal's end? None of my code changed, but since yesterday none of my tests using sandbox will work anymore.


Solution

  • It was actually a problem with my Python code. Oddly enough, I had not changed the requests module, but it stopped working with the same code.

    Once I changed to sending the IPN variables through 'data' argument, instead of 'params', then I was able to receive a response like normal.

    r = requests.post("https://www.sandbox.paypal.com/cgi-bin/webscr", data = params)