Hey there! I'm integrating Paypal's IPN system, and their authentication process requires my server to respond to a Paypal request with a POST to Paypal with parameters EXACTLY the same as Paypal sent me (although with an appended string). So, I've turned the params hash into a string (appropriately formatted) and sent it back, but it looks like the resulting string is not in the same order as the original POST parameters (resulting in no authentication).
Anyone know how I can access the actual POST parameters themselves (as opposed to the params hash), so that I can copy that and send it back to Paypal? The catch is that the order of parameters that I send to Paypal needs to be exactly the same as the request that hit my server.
Does that make sense? An开发者_Python百科y thoughts? Thanks in advance!
--Jared
Paypal's IPN can be a little finicky if I remember correctly (You really have to give them exactly what they sent with your message appended or nothing works).
You should probably grab the raw post data in your controller, append a string to it, and construct some sort of HTTP request with your raw post data before posting it back. I remember doing it the last time I used paypal's IPN, and it worked relatively well.
I would use ActionController#raw_post and just modify it before sending a request back to paypal. Also keep in mind there is a timeout for IPN responses (I think) and paypal may send you multiple notifications with the exact same data if they don't get back what they expect, so you probably want to send them a request back immediately before your code does anything else.
You cannot use the params hash, ordering is lost. Use the original request strings, for example request.request_uri
or request.query_string
.
精彩评论