WC_REST_Paypal_Webhooks_Controller::validate_webhook
Validate the webhook.
Method of the class: WC_REST_Paypal_Webhooks_Controller{}
No Hooks.
Returns
true|false. True if the webhook is valid, false otherwise.
Usage
$WC_REST_Paypal_Webhooks_Controller = new WC_REST_Paypal_Webhooks_Controller(); $WC_REST_Paypal_Webhooks_Controller->validate_webhook( $request );
- $request(WP_REST_Request) (required)
- The request object.
WC_REST_Paypal_Webhooks_Controller::validate_webhook() WC REST Paypal Webhooks Controller::validate webhook code WC 10.3.6
public function validate_webhook( WP_REST_Request $request ) {
try {
if (
class_exists( 'Automattic\Jetpack\Connection\REST_Authentication' ) &&
method_exists( 'Automattic\Jetpack\Connection\REST_Authentication', 'is_signed_with_blog_token' )
) {
return \Automattic\Jetpack\Connection\REST_Authentication::is_signed_with_blog_token();
}
return false;
} catch ( \Throwable $e ) {
WC_Gateway_Paypal::log( 'REST authentication method not available. Webhook data: ' . wc_print_r( $request->get_json_params(), true ), 'error' );
return false;
}
}