I’m currently writing a plugin that requires the PayPal IPN, since the IPN is not inside the main plugin file, I have no way to use $wpdb. If you know a way to do this that will work with all WordPress installations it would really help me!
Thanks in advance!
Use the ajax api: http://codex.wordpress.org/AJAX_in_Plugins
If you let all your ajax calls go through this you will have access to all WP functions.
Also take a look at these: http://www.james-vandyne.com/process-paypal-ipn-requests-through-wordpress/
http://wordpress.org/extend/plugins/paypal-framework/
Don’t know if what you want is in there, but worth a look.