WooCommerce Code Reference

WC_Payment_Token_Data_Store_Interface

Payment Token Data Store Interface

Tags
version
3.0.0

Table of Contents

get_metadata()  : array
Returns metadata for a specific payment token.
get_token_by_id()  : object
Returns an stdObject of a token.
get_token_type_by_id()  : string
Get a token's type by ID.
get_tokens()  : array
Returns an array of objects (stdObject) matching specific token criteria.
get_users_default_token()  : object
Returns an stdObject of a token for a user's default token.
set_default_status()  : string
Update's a tokens default status in the database. Used for quickly looping through tokens and setting their statuses instead of creating a bunch of objects.

Methods

get_tokens()

Returns an array of objects (stdObject) matching specific token criteria.

public get_tokens(array $args) : array

Accepts token_id, user_id, gateway_id, and type. Each object should contain the fields token_id, gateway_id, token, user_id, type, is_default.

Parameters
$args : array

Arguments.

Return values
array

get_users_default_token()

Returns an stdObject of a token for a user's default token.

public get_users_default_token(int $user_id) : object

Should contain the fields token_id, gateway_id, token, user_id, type, is_default.

Parameters
$user_id : int

User ID.

Return values
object

set_default_status()

Update's a tokens default status in the database. Used for quickly looping through tokens and setting their statuses instead of creating a bunch of objects.

public set_default_status(int $token_id[, bool $status = true ]) : string
Parameters
$token_id : int

Token ID.

$status : bool = true

If should update status.

Return values
string