WooCommerce Code Reference

Search results

WC_Payment_Token_Data_Store_Interface

WC Payment Token Data Store Interface

Functions that must be defined by payment token store classes.

Table of Contents

get_tokens() Returns an array of objects (stdObject) matching specific token criteria. array
get_users_default_token() Returns an stdObject of a token for a user's default token. object
get_token_by_id() Returns an stdObject of a token. object
get_metadata() Returns metadata for a specific payment token. array
get_token_type_by_id() Get a token's type by ID. string
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. string

Methods

get_tokens()

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

public get_tokens( $args : array ) : 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( $user_id : int ) : object

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

Parameters
$user_id : int

User ID.

Return values
object

get_token_by_id()

Returns an stdObject of a token.

public get_token_by_id( $token_id : int ) : object

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

Parameters
$token_id : int

Token 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( $token_id : int [, $status : bool = true ] ) : string
Parameters
$token_id : int

Token ID.

$status : bool = true

If should update status.

Return values
string
Back to the top