WC_Payment_Tokens::get_customer_tokens()public staticWC 2.6.0

Returns an array of payment token objects associated with the passed customer ID.

Метод класса: WC_Payment_Tokens{}

Возвращает

WC_Payment_Token[]. Array of token objects.

Использование

$result = WC_Payment_Tokens::get_customer_tokens( $customer_id, $gateway_id );
$customer_id(int) (обязательный)
Customer ID.
$gateway_id(строка)
Optional Gateway ID for getting tokens for a specific gateway.
По умолчанию: ''

Список изменений

С версии 2.6.0 Введена.

Код WC_Payment_Tokens::get_customer_tokens() WC 8.7.0

public static function get_customer_tokens( $customer_id, $gateway_id = '' ) {
	if ( $customer_id < 1 ) {
		return array();
	}

	$tokens = self::get_tokens(
		array(
			'user_id'    => $customer_id,
			'gateway_id' => $gateway_id,
			/**
			 * Controls the maximum number of Payment Methods that will be listed via the My Account page.
			 *
			 * @since 7.2.0
			 *
			 * @param int $limit Defaults to the value of the `posts_per_page` option.
			 */
			'limit'      => apply_filters( 'woocommerce_get_customer_payment_tokens_limit', get_option( 'posts_per_page' ) ),
		)
	);

	return apply_filters( 'woocommerce_get_customer_payment_tokens', $tokens, $customer_id, $gateway_id );
}