This is the documentation provided by the payments company:
"
The IPN protocol consists of three steps:
- Payson sends your IPN listener a message that notifies you of the event.
- Your listener sends the complete unaltered message back to Payson; the message must
contain the same parameters in the same order and be encoded in the same way as
the original message.
- Payson sends a single word back, which is either VERIFIED
if the message originated from Payson or INVALID if there
is any discrepancy with what was originally sent.
"
I am by no means an experienced web developer so I might have misunderstood something, but I figured I need to do something like the following;
message = request.vars
request = urllib2.Request(cmd, message)
response = urllib2.urlopen(request)
.
The problem here is that message needs to be a string so the first line is obviously not correct. What could I do instead?
Edit: I could do urllib.urlencode(request.vars) which manages to send the message back, but the response is INVALID, likely because the ordering of the parameters and maybe the encoding isn't the same as what they sent. I do not know how web2py handles requests, but could I perhaps intercept the message before it is turned into a Storage object or could the problem be solved in some other way?
Edit2: Seems to have solved it with the request.body.read() method!