WC_REST_Paypal_Webhooks_Controller::process_webhook
Process the webhook.
Method of the class: WC_REST_Paypal_Webhooks_Controller{}
No Hooks.
Returns
WP_REST_Response. The response object.
Usage
$WC_REST_Paypal_Webhooks_Controller = new WC_REST_Paypal_Webhooks_Controller(); $WC_REST_Paypal_Webhooks_Controller->process_webhook( $request );
- $request(WP_REST_Request) (required)
- The request object.
WC_REST_Paypal_Webhooks_Controller::process_webhook() WC REST Paypal Webhooks Controller::process webhook code WC 10.3.6
public function process_webhook( WP_REST_Request $request ) {
include_once WC_ABSPATH . 'includes/gateways/paypal/includes/class-wc-gateway-paypal-webhook-handler.php';
$webhook_handler = new WC_Gateway_Paypal_Webhook_Handler();
try {
$webhook_handler->process_webhook( $request );
return new WP_REST_Response( array( 'message' => 'Webhook processed successfully' ), 200 );
} catch ( Exception $e ) {
return new WP_REST_Response( array( 'error' => $e->getMessage() ), 500 );
}
}