There are official code samples for several languages but couldn\'t find one for Rails.
DWilke's Paypal IPN gem can be found here:
https://github.com/dwilkie/paypal
Check out the IPN module. It's nice code:
https://github.com/dwilkie/paypal/blob/master/lib/paypal/ipn/ipn.rb
You can test it out against the IPN simulator here:
https://developer.paypal.com/webapps/developer/applications/ipn_simulator
I use ngrok to expose localhost:3000 on a public URL, then point the simulator at it.