Using Gravity Forms ‘gform_paypalpaymentspro_verifypeer’ PHP filter

The gform_paypalpaymentspro_verifypeer filter allows you to bypass SSL peer verification for PayPal Payments Pro transactions in Gravity Forms.

Usage

add_filter('gform_paypalpaymentspro_verifypeer', 'your_function_name', 10, 1);

Parameters

  • $is_enabled (bool): Indicates if the CURLOPT_SSL_VERIFYPEER setting is enabled. True enables peer verification, false disables it.

More information

See Gravity Forms Docs: gform_paypalpaymentspro_verifypeer

Examples

Disable SSL Peer Verification

This example disables SSL peer verification for PayPal Payments Pro transactions.

add_filter('gform_paypalpaymentspro_verifypeer', 'disable_verification', 10, 1);

function disable_verification($is_enabled) {
    return false;
}

Enable SSL Peer Verification

This example enables SSL peer verification for PayPal Payments Pro transactions.

add_filter('gform_paypalpaymentspro_verifypeer', 'enable_verification', 10, 1);

function enable_verification($is_enabled) {
    return true;
}

Conditionally Disable SSL Peer Verification

This example disables SSL peer verification for PayPal Payments Pro transactions only when the form ID is 5.

add_filter('gform_paypalpaymentspro_verifypeer', 'conditionally_disable_verification', 10, 1);

function conditionally_disable_verification($is_enabled) {
    $form_id = rgpost('gform_form_id');
    if ($form_id == 5) {
        return false;
    }
    return $is_enabled;
}

Toggle SSL Peer Verification Based on Environment

This example enables SSL peer verification for PayPal Payments Pro transactions in production and disables it in the development environment.

add_filter('gform_paypalpaymentspro_verifypeer', 'toggle_verification_based_on_environment', 10, 1);

function toggle_verification_based_on_environment($is_enabled) {
    if (defined('WP_ENV') && WP_ENV === 'development') {
        return false;
    }
    return true;
}

Log SSL Peer Verification Status

This example logs the current SSL peer verification status for PayPal Payments Pro transactions.

add_filter('gform_paypalpaymentspro_verifypeer', 'log_verification_status', 10, 1);

function log_verification_status($is_enabled) {
    error_log('SSL peer verification status: ' . ($is_enabled ? 'Enabled' : 'Disabled'));
    return $is_enabled;
}