I think that you would benefit from the IPN simulator that PayPal has available from their developer center.
The IPN is a form post, so you can trigger the server behaviors on the posted values that are sent via IPN. The first thing to do is to verify the post as authentic, then you can use the posted values to trigger server behaviors on this page. For the order information there should be an order id or reference id that PayPal passes back. If you need to you can use the invoice variable when sending the transaction to PayPal, this should pass through and be posted to your IPN page just as you sent it to PayPal. There is also a custom field that you can use to pass through info.
You should login to the PayPal developer center and check out some of the documentation and other resources that are available, they will do a much better job of explaining the process and how it all works together.