Automattic\WooCommerce\Gateways\PayPal

WebhookHandler::authorize_or_capture_paymentprivateWC 10.5.0

Capture the payment.

Method of the class: WebhookHandler{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->authorize_or_capture_payment( $order, $links, $action ): void;
$order(WC_Order) (required)
The order object.
$links(array) (required)
The links from the webhook event.
$action(string) (required)
The action to perform (capture or authorize).

Changelog

Since 10.5.0 Introduced.

WebhookHandler::authorize_or_capture_payment() code WC 10.7.0

private function authorize_or_capture_payment( \WC_Order $order, array $links, string $action ): void {
	$action_url = $this->get_action_url( $links, $action );

	$payment_gateways = WC()->payment_gateways()->payment_gateways();
	if ( ! isset( $payment_gateways['paypal'] ) ) {
		\WC_Gateway_Paypal::log( 'PayPal gateway is not available.' );
		return;
	}
	$gateway        = $payment_gateways['paypal'];
	$paypal_request = new PayPalRequest( $gateway );
	$paypal_request->authorize_or_capture_payment( $order, $action_url, $action );
}