WooCommerce Code Reference

Api
in package

The Api class provides an interface to payment method registration.

Tags
since
2.6.0

Table of Contents

$asset_registry  : AssetDataRegistry
Reference to the AssetDataRegistry instance.
$payment_method_registry  : PaymentMethodRegistry
Reference to the PaymentMethodRegistry instance.
__construct()  : mixed
Constructor
add_payment_method_script_data()  : mixed
Add payment method data to Asset Registry.
add_payment_method_script_dependencies()  : array<string|int, mixed>
Add payment method script handles as script dependencies.
init()  : mixed
Initialize class features.
register_payment_method_integrations()  : mixed
Register payment method integrations bundled with blocks.
verify_payment_methods_dependencies()  : mixed
Verify all dependencies of registered payment methods have been registered.
is_payment_gateway_enabled()  : bool
Returns true if the payment gateway is enabled.

Properties

Methods

add_payment_method_script_data()

Add payment method data to Asset Registry.

public add_payment_method_script_data() : mixed
Return values
mixed

add_payment_method_script_dependencies()

Add payment method script handles as script dependencies.

public add_payment_method_script_dependencies(array<string|int, mixed> $dependencies, string $handle) : array<string|int, mixed>
Parameters
$dependencies : array<string|int, mixed>

Array of script dependencies.

$handle : string

Script handle.

Return values
array<string|int, mixed>

register_payment_method_integrations()

Register payment method integrations bundled with blocks.

public register_payment_method_integrations(PaymentMethodRegistry $payment_method_registry) : mixed
Parameters
$payment_method_registry : PaymentMethodRegistry

Payment method registry instance.

Return values
mixed

verify_payment_methods_dependencies()

Verify all dependencies of registered payment methods have been registered.

public verify_payment_methods_dependencies() : mixed

If not, remove that payment method script from the list of dependencies of Cart and Checkout block scripts so it doesn't break the blocks and show an error in the admin.

Return values
mixed

is_payment_gateway_enabled()

Returns true if the payment gateway is enabled.

private is_payment_gateway_enabled(object $gateway) : bool
Parameters
$gateway : object

Payment gateway.

Return values
bool