WC_Payment_Token_Data_Store_Interface
in
WC Payment Token Data Store Interface
Functions that must be defined by payment token store classes.
Tags
Table of Contents
- get_metadata() : array<string|int, mixed>
- 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<string|int, mixed>
- 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_metadata()
Returns metadata for a specific payment token.
public
get_metadata(int $token_id) : array<string|int, mixed>
Parameters
- $token_id : int
-
Token ID.
Return values
array<string|int, mixed> —get_token_by_id()
Returns an stdObject of a token.
public
get_token_by_id(int $token_id) : object
Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
Parameters
- $token_id : int
-
Token ID.
Return values
object —get_token_type_by_id()
Get a token's type by ID.
public
get_token_type_by_id(int $token_id) : string
Parameters
- $token_id : int
-
Token ID.
Return values
string —get_tokens()
Returns an array of objects (stdObject) matching specific token criteria.
public
get_tokens(array<string|int, mixed> $args) : array<string|int, mixed>
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<string|int, mixed>
-
Arguments.
Return values
array<string|int, mixed> —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.