Skip to content

Instantly share code, notes, and snippets.

@edisoncosta
Last active March 8, 2024 19:19
Show Gist options
  • Save edisoncosta/8a85384a2c126e2a15bb4c77208fd5f9 to your computer and use it in GitHub Desktop.
Save edisoncosta/8a85384a2c126e2a15bb4c77208fd5f9 to your computer and use it in GitHub Desktop.
Correção pagarme (woocommerce-pagarme/includes/class-wc-pagarme-api.php)
public function ipn_handler() {
@ob_clean();
$ipn_response = ! empty( $_POST ) ? $_POST : false;
$valid_ip = '34.231.60.225';
$remote_ip = $_SERVER['REMOTE_ADDR'];
// Verifica se a resposta IPN não está vazia e se o IP do remetente é igual ao IP válido
if ( $ipn_response && $remote_ip == $valid_ip ) {
header( 'HTTP/1.1 200 OK' );
$this->process_successful_ipn( $ipn_response );
// Deprecated action since 2.0.0.
do_action( 'wc_pagarme_valid_ipn_request', $ipn_response );
exit;
} else {
wp_die( esc_html__( 'Pagar.me Request Failure', 'woocommerce-pagarme' ), '', array( 'response' => 401 ) );
}
}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment