WordPress at Your Fingertips
function is not described

WC_Payment_Gateway::get_tokens() public WC 2.6.0

Returns a users saved tokens for this gateway.

{} It's a method of the class: WC_Payment_Gateway{}

No Hooks.

Return

Array.

Usage

$WC_Payment_Gateway = new WC_Payment_Gateway();
$WC_Payment_Gateway->get_tokens();

Changelog

Since 2.6.0 Introduced.

Code of WC_Payment_Gateway::get_tokens() WC 5.5.2

<?php
public function get_tokens() {
	if ( count( $this->tokens ) > 0 ) {
		return $this->tokens;
	}

	if ( is_user_logged_in() && $this->supports( 'tokenization' ) ) {
		$this->tokens = WC_Payment_Tokens::get_customer_tokens( get_current_user_id(), $this->id );
	}

	return $this->tokens;
}