How Can I Use $wpdb in PayPal IPN file?

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.

Leave a Comment