WooCommerce Code Reference

WebhookHandler
in package

Class WebhookHandler file.

Handles webhook events.

Tags
since
10.5.0

Table of Contents

process_webhook()  : void
Process the webhook event.
authorize_or_capture_payment()  : void
Capture the payment.
get_action_url()  : string|null
Get the action URL from the links.
process_checkout_order_approved()  : void
Process the CHECKOUT.ORDER.APPROVED webhook event.
process_payment_authorization_created()  : void
Process the PAYMENT.AUTHORIZATION.CREATED webhook event.
process_payment_capture_completed()  : void
Process the PAYMENT.CAPTURE.COMPLETED webhook event.
process_payment_capture_pending()  : void
Process the PAYMENT.CAPTURE.PENDING webhook event.

Methods

process_webhook()

Process the webhook event.

public process_webhook(WP_REST_Request $request) : void
Parameters
$request : WP_REST_Request

The request object.

Tags
since
10.5.0
Return values
void

authorize_or_capture_payment()

Capture the payment.

private authorize_or_capture_payment(WC_Order $order, array<string|int, mixed> $links, string $action) : void
Parameters
$order : WC_Order

The order object.

$links : array<string|int, mixed>

The links from the webhook event.

$action : string

The action to perform (capture or authorize).

Tags
since
10.5.0
Return values
void

get_action_url()

Get the action URL from the links.

private get_action_url(array<string|int, mixed> $links, string $action) : string|null
Parameters
$links : array<string|int, mixed>

The links from the webhook event.

$action : string

The action to perform (capture or authorize).

Tags
since
10.5.0
Return values
string|null

process_checkout_order_approved()

Process the CHECKOUT.ORDER.APPROVED webhook event.

private process_checkout_order_approved(array<string|int, mixed> $event) : void
Parameters
$event : array<string|int, mixed>

The webhook event data.

Tags
since
10.5.0
Return values
void

process_payment_authorization_created()

Process the PAYMENT.AUTHORIZATION.CREATED webhook event.

private process_payment_authorization_created(array<string|int, mixed> $event) : void
Parameters
$event : array<string|int, mixed>

The webhook event data.

Tags
since
10.5.0
Return values
void

process_payment_capture_completed()

Process the PAYMENT.CAPTURE.COMPLETED webhook event.

private process_payment_capture_completed(array<string|int, mixed> $event) : void
Parameters
$event : array<string|int, mixed>

The webhook event data.

Tags
since
10.5.0
Return values
void

process_payment_capture_pending()

Process the PAYMENT.CAPTURE.PENDING webhook event.

private process_payment_capture_pending(array<string|int, mixed> $event) : void
Parameters
$event : array<string|int, mixed>

The webhook event data.

Tags
since
10.5.0
Return values
void