spivurno
12/21/2019 - 3:42 PM

Hack: Process PayPal Payments Locally

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 );