Created
December 21, 2019 15:42
-
-
Save spivurno/80846335bb674ba2f2b28f21f82c591e to your computer and use it in GitHub Desktop.
Hack: Process PayPal Payments Locally
This file contains hidden or 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
<?php | |
/** | |
* Hack to process payment when returning to site from PayPal. | |
* http://gravitywiz.com/ | |
* | |
* WARNING: This should only be used when testing on local sites. | |
*/ | |
add_action( 'init', function() { | |
function gw_intercept_ipn_verification() { | |
remove_filter( 'pre_http_request', 'gw_intercept_ipn_verification' ); | |
return array( 'body' => 'VERIFIED' ); | |
}; | |
if ( rgget( 'gf_paypal_return' ) ) { | |
$_GET['page'] = 'gf_paypal_ipn'; | |
$_POST['test_ipn'] = true; | |
add_filter( 'pre_http_request', 'gw_intercept_ipn_verification' ); | |
gf_paypal()->maybe_process_callback(); | |
} | |
}, 20 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment