Reputation: 23634
I can't seem to get my app to accept POST requests from a different domain. I'm trying to make an PayPal IPN handler in my app.
When a user clicks the "Subscribe" button on my page, PayPal sends an IPN (a POST), to my IPN handler.
I can see in my AppEngine logs that a POST request is received, but it is empty (e.g. no arguments, my logging.debug messages aren't showing up in the logs, etc.)
So I test my handler by making a POST to it within my app, and the handler works as expected.
I'm assuming it's a security feature to not accept POSTs from outside sources? If so, how do I make my app accept POSTs from PayPal?
Here's what my handler looks like at the moment (it's just for testing):
class BaseHandler(tornadotoad.mixin.RequestHandler, tornado.web.RequestHandler):
# ...
class IPNHandler(BaseHandler):
def post(self):
if is_ajax(self.request):
logging.info('AJAX')
logging.info(self.request.arguments)
self.write("This is the IPN Handler\n'")
self.write(self.request.arguments)
return
Thanks in advance.
P.S. I'm using PayPal's Sandbox Test Tool to send the IPN
Upvotes: 0
Views: 563
Reputation: 23634
I found my mistake. I put the url for the handler together with the other urls, which has login: required
in app.yaml
.
I've fixed this and now PayPal's IPN is getting through.
Thanks everyone!
Upvotes: 2
Reputation: 3651
A few hunches here.
Maybe "/ipn" is not being routed to IPNHandler. Perhaps another deprecated handler?
Maybe the app version you are looking at in your logs is not the same as the one you have. Perhaps you can deploy a new version of your code and test against the new one.
Maybe the POST request Paypal is sending you has no arguments.
P.S. More info on how you are performing tests from Paypal's end, showing other relevant parts of your code, and any other relevant info could help. :)
Upvotes: 1
Reputation: 543
Just a hunch, and I might be way out of my league here but for tornado I don't seem to be able to find either a method or an attribute of that name in the docs...
At least for webapp I believe arguments
is an instance method:
logging.info(self.request.arguments())
see the docs here.
Upvotes: 0