Skip to content

Instantly share code, notes, and snippets.

@spivurno
Created December 21, 2019 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spivurno/80846335bb674ba2f2b28f21f82c591e to your computer and use it in GitHub Desktop.
Save spivurno/80846335bb674ba2f2b28f21f82c591e to your computer and use it in GitHub Desktop.
Hack: Process PayPal Payments Locally
<?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