WC_Payment_Gateways
in package
Payment gateways class.
Table of Contents
- $payment_gateways : array<string|int, mixed>
- Payment gateway classes.
- $_instance : WC_Payment_Gateways
- The single instance of the class.
- __clone() : mixed
- Cloning is forbidden.
- __construct() : mixed
- Initialize payment gateways.
- __wakeup() : mixed
- Unserializing instances of this class is forbidden.
- get_available_payment_gateways() : array<string|int, mixed>
- Get available gateways for checkout.
- get_payment_gateway_ids() : array<string|int, mixed>
- Get array of registered gateway ids
- init() : mixed
- Load gateways and hook in functions.
- instance() : WC_Payment_Gateways
- Main WC_Payment_Gateways Instance.
- payment_gateways() : array<string|int, mixed>
- Get gateways.
- process_admin_options() : mixed
- Save options in admin.
- set_current_gateway() : mixed
- Set the current, active gateway.
- filter_valid_gateway_class() : bool
- Callback for array filter. Returns true if gateway is of correct type.
- should_load_paypal_standard() : bool
- Determines if PayPal Standard should be loaded.
- notify_admin_payment_gateway_enabled() : bool
- Email the site admin when a payment gateway has been enabled.
- payment_gateway_settings_option_changed() : mixed
- Callback for when a gateway settings option was added or updated.
- record_gateway_event() : void
- Send a Tracks event.
- was_gateway_disabled() : bool
- Determines from changes in settings if a gateway was disabled.
- was_gateway_enabled() : bool
- Determines from changes in settings if a gateway was enabled.
Properties
$payment_gateways
Payment gateway classes.
public
array<string|int, mixed>
$payment_gateways
= array()
$_instance
The single instance of the class.
protected
static WC_Payment_Gateways
$_instance
=
ull
Tags
Methods
__clone()
Cloning is forbidden.
public
__clone() : mixed
Tags
Return values
mixed —__construct()
Initialize payment gateways.
public
__construct() : mixed
Return values
mixed —__wakeup()
Unserializing instances of this class is forbidden.
public
__wakeup() : mixed
Tags
Return values
mixed —get_available_payment_gateways()
Get available gateways for checkout.
public
get_available_payment_gateways() : array<string|int, mixed>
This should be used when displaying the available gateways/payment methods to the user, not in the WP admin or REST API contexts where there is no WC session. This is because the logic that hooks into the available gateways filter may try to rely on the existence of a WC session - a valid thing to do, and cause fatal errors when the session is not available.
Return values
array<string|int, mixed> — The available payment gateways.get_payment_gateway_ids()
Get array of registered gateway ids
public
get_payment_gateway_ids() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> — of stringsinit()
Load gateways and hook in functions.
public
init() : mixed
Return values
mixed —instance()
Main WC_Payment_Gateways Instance.
public
static instance() : WC_Payment_Gateways
Ensures only one instance of WC_Payment_Gateways is loaded or can be loaded.
Tags
Return values
WC_Payment_Gateways — Main instancepayment_gateways()
Get gateways.
public
payment_gateways() : array<string|int, mixed>
Return values
array<string|int, mixed> —process_admin_options()
Save options in admin.
public
process_admin_options() : mixed
Return values
mixed —set_current_gateway()
Set the current, active gateway.
public
set_current_gateway(array<string|int, mixed> $gateways) : mixed
Parameters
- $gateways : array<string|int, mixed>
-
Available payment gateways.
Return values
mixed —filter_valid_gateway_class()
Callback for array filter. Returns true if gateway is of correct type.
protected
filter_valid_gateway_class(object $gateway) : bool
Parameters
- $gateway : object
-
Gateway to check.
Tags
Return values
bool —should_load_paypal_standard()
Determines if PayPal Standard should be loaded.
protected
should_load_paypal_standard() : bool
Tags
Return values
bool — Whether PayPal Standard should be loaded or not.notify_admin_payment_gateway_enabled()
Email the site admin when a payment gateway has been enabled.
private
notify_admin_payment_gateway_enabled(WC_Payment_Gateway $gateway) : bool
Parameters
- $gateway : WC_Payment_Gateway
-
The gateway that was enabled.
Tags
Return values
bool — Whether the email was sent or not.payment_gateway_settings_option_changed()
Callback for when a gateway settings option was added or updated.
private
payment_gateway_settings_option_changed(WC_Payment_Gateway $gateway, mixed $value, string $option[, mixed $old_value = null ]) : mixed
Parameters
- $gateway : WC_Payment_Gateway
-
The gateway for which the option was added or updated.
- $value : mixed
-
New value.
- $option : string
-
Option name.
- $old_value : mixed = null
-
Old value.
null
when called via add_option_ hook.
Tags
Return values
mixed —record_gateway_event()
Send a Tracks event.
private
record_gateway_event(string $name, WC_Payment_Gateway $gateway) : void
By default, Woo adds url
, blog_lang
, blog_id
, store_id
, products_count
, and wc_version
properties to every event.
Parameters
- $name : string
-
The event name. If it is not prefixed, it will be with the standard prefix.
- $gateway : WC_Payment_Gateway
-
The payment gateway object.
Return values
void —was_gateway_disabled()
Determines from changes in settings if a gateway was disabled.
private
was_gateway_disabled(array<string|int, mixed> $value[, array<string|int, mixed> $old_value = null ]) : bool
Parameters
- $value : array<string|int, mixed>
-
New value.
- $old_value : array<string|int, mixed> = null
-
Old value.
Return values
bool — Whether the gateway was disabled or not.was_gateway_enabled()
Determines from changes in settings if a gateway was enabled.
private
was_gateway_enabled(array<string|int, mixed> $value[, array<string|int, mixed> $old_value = null ]) : bool
Parameters
- $value : array<string|int, mixed>
-
New value.
- $old_value : array<string|int, mixed> = null
-
Old value.