WooCommerce Code Reference

PaymentUtils
in package

PaymentUtils

Utility class for payment methods.

Table of Contents

get_default_payment_method()  : string
Returns the default payment method for a customer.
get_enabled_payment_gateways()  : array<string|int, mixed>
Get enabled payment gateways.
get_saved_payment_methods()  : array<string|int, mixed>
Returns enabled saved payment methods for a customer and the default method if there are multiple.
include_token_id_with_payment_methods()  : array<string|int, mixed>
Callback for woocommerce_payment_methods_list_item filter to add token id to the generated list.

Methods

get_default_payment_method()

Returns the default payment method for a customer.

public static get_default_payment_method() : string
Return values
string

get_enabled_payment_gateways()

Get enabled payment gateways.

public static get_enabled_payment_gateways() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_saved_payment_methods()

Returns enabled saved payment methods for a customer and the default method if there are multiple.

public static get_saved_payment_methods() : array<string|int, mixed>
Return values
array<string|int, mixed>

include_token_id_with_payment_methods()

Callback for woocommerce_payment_methods_list_item filter to add token id to the generated list.

public static include_token_id_with_payment_methods(array<string|int, mixed> $list_item, WC_Token $token) : array<string|int, mixed>
Parameters
$list_item : array<string|int, mixed>

The current list item for the saved payment method.

$token : WC_Token

The token for the current list item.

Return values
array<string|int, mixed>The list item with the token id added.