'.esc_html__('Unable to create/update PayPal Checkout webhook. PayPal requires an HTTPS (SSL) webhook URL, but your site URL appears to be configured without HTTPS. Please enable SSL and update your WordPress Site URL/Home URL to use https://, then try again.', 's2member').'
'."\n";
else
{
//260216 IMPORTANT:
// Do not block webhook creation/update based on a server-side "loopback" probe.
// Many shared hosts/WAFs return false negatives for loopback requests (e.g., HEAD blocked,
// ModSecurity rules, disabled loopback/outbound HTTP). PayPal can still deliver webhooks
// successfully from the outside.
$r = c_ws_plugin__s2member_paypal_utilities::paypal_checkout_webhook_upsert($env);
if(!empty($r['id']))
{
$ppco_webhook_notice = ''.sprintf(esc_html__('PayPal Checkout %1$s webhook created/updated successfully.', 's2member'), $env_label).'
'."\n";
//260824.0507 The persistent warning was rendered before this page action ran; remove that now-resolved copy immediately.
$ppco_webhook_notice .= ''."\n";
}
else
$ppco_webhook_notice = ''."\n";
}
}
else
$ppco_webhook_notice = ''.sprintf(esc_html__('PayPal Checkout %1$s credentials are not configured.', 's2member'), $env_label).'
'."\n";
}
else
$ppco_webhook_notice = ''.esc_html__('Invalid request. Please try again.', 's2member').'
'."\n";
}
// No redirect; display notice inline.
if(!empty($ppco_r['s2member_ppco_creds_test']) && empty($ppco_r['s2member_ppco_webhook']) && empty($ppco_r['s2member_ppco_clear_cache']) && current_user_can('manage_options'))
{
if(!empty($ppco_r['_wpnonce']) && wp_verify_nonce((string)$ppco_r['_wpnonce'], 's2member_ppco_creds_test'))
{
$env = (!empty($ppco_r['ppco_creds_env']) && $ppco_r['ppco_creds_env'] === 'sandbox') ? 'sandbox' : 'live';
$env_label = ($env === 'sandbox') ? esc_html__('Sandbox', 's2member') : esc_html__('Live', 's2member');
$client_id = '';
$secret = '';
if($env === 'sandbox')
{
$client_id = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_checkout_sandbox_client_id"];
$secret = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_checkout_sandbox_client_secret"];
}
else // live
{
$client_id = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_checkout_client_id"];
$secret = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_checkout_client_secret"];
}
if(!empty($client_id) && !empty($secret))
{
$ok = c_ws_plugin__s2member_paypal_utilities::paypal_checkout_creds_test($env);
if($ok)
$ppco_creds_notice = ''.sprintf(esc_html__('PayPal Checkout %1$s credentials test OK.', 's2member'), $env_label).'
'."\n";
else
$ppco_creds_notice = ''.sprintf(esc_html__('PayPal Checkout %1$s credentials test failed. Please verify that the Client ID and Secret were copied from the same PayPal %1$s REST app, paste them again, save options, and test again. See the s2Member paypal-checkout.log for details.', 's2member'), $env_label).' '.esc_html__('Log Viewer', 's2member').'
'."\n";
}
else
$ppco_creds_notice = ''.sprintf(esc_html__('PayPal Checkout %1$s credentials are not configured.', 's2member'), $env_label).'
'."\n";
}
else
$ppco_creds_notice = ''.esc_html__('Invalid request. Please try again.', 's2member').'
'."\n";
}
// No redirect; display notice inline.
if(!empty($ppco_r['s2member_ppco_clear_cache']) && empty($ppco_r['s2member_ppco_webhook']) && empty($ppco_r['s2member_ppco_creds_test']) && current_user_can('manage_options'))
{
if(!empty($ppco_r['_wpnonce']) && wp_verify_nonce((string)$ppco_r['_wpnonce'], 's2member_ppco_clear_cache'))
{
$env = (!empty($ppco_r['ppco_clear_env']) && $ppco_r['ppco_clear_env'] === 'sandbox') ? 'sandbox' : 'live';
$env_label = ($env === 'sandbox') ? esc_html__('Sandbox', 's2member') : esc_html__('Live', 's2member');
c_ws_plugin__s2member_paypal_utilities::paypal_checkout_clear_cache($env);
$ppco_cache_notice = ''.sprintf(esc_html__('PayPal Checkout cache cleared for %1$s.', 's2member'), $env_label).'
'."\n";
}
else
$ppco_cache_notice = ''.esc_html__('Invalid request. Please try again.', 's2member').'
'."\n";
}
// No redirect; display notice inline.
echo ''."\n";
}
}
}
new c_ws_plugin__s2member_menu_page_paypal_ops();