WC_REST_Paypal_Webhooks_Controller::process_webhook │ public │ WC 1.0

Process the webhook.

Метод класса: WC_REST_Paypal_Webhooks_Controller{}

Хуков нет.

Возвращает

WP_REST_Response. The response object.

Использование

$WC_REST_Paypal_Webhooks_Controller = new WC_REST_Paypal_Webhooks_Controller();
$WC_REST_Paypal_Webhooks_Controller->process_webhook( $request );
$request(WP_REST_Request) (обязательный)
The request object.

Код WC_REST_Paypal_Webhooks_Controller::process_webhook() WC 11.2.2

public function process_webhook( WP_REST_Request $request ) {
	$webhook_handler = new PayPalWebhookHandler();

	try {
		$webhook_handler->process_webhook( $request );
		return new WP_REST_Response( array( 'message' => 'Webhook processed successfully' ), 200 );
	} catch ( \Throwable $e ) {
		WC_Gateway_Paypal::log( 'Error processing webhook: ' . $e->getMessage() );
		return new WP_REST_Response( array( 'error' => __( 'Webhook processing failed.', 'woocommerce' ) ), 500 );
	}
}