-
-
Save andrewlimaza/3864c58c0cf1c32ece2e381376ba6ca5 to your computer and use it in GitHub Desktop.
Forward PMPro PayPal IPNs to another domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Forward PMPro PayPal IPNs to another domain. | |
* Each domain will process the IPNs. The IPN handlers should be setup to ignore | |
* messages that aren't for that site. PMPro does this. | |
* This is useful if you have 2 different sites using the same PayPal account | |
* and the IPN is setup to go to a PMPro site. | |
* Add this to a custom plugin on the PMPro site the IPN hits. | |
* Update the domain/url to the IPN you want to forward to. | |
* The pmprodev_gateway_debug_setup check makes sure this DOESN'T run if you have the | |
* PMPro Toolkit plugin enabled, i.e. you are on a staging site. | |
*/ | |
function my_pmpro_forward_ipn() { | |
if ( ! function_exists( 'pmprodev_gateway_debug_setup' ) ) { | |
$fp = wp_remote_post( 'https://yourdomain.com/wp-admin/admin-ajax.php?action=ipnhandler', $_POST ); | |
} | |
} | |
add_action('wp_ajax_nopriv_ipnhandler', 'my_pmpro_forward_ipn', 5); | |
add_action('wp_ajax_ipnhandler', 'my_pmpro_forward_ipn', 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment