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.