CartTokenUtils
in package
Cart token utility functions.
Table of Contents
- get_cart_token() : string
- Generate a cart token.
- get_cart_token_payload() : array<string|int, mixed>
- Get the cart token payload.
- validate_cart_token() : bool
- Validate the cart token.
- get_cart_token_expiration() : int
- Gets the expiration of the cart token. Defaults to 48h.
- get_cart_token_secret() : string
- Get the cart token secret.
Methods
get_cart_token()
Generate a cart token.
public
static get_cart_token(string $customer_id) : string
Parameters
- $customer_id : string
-
The customer ID.
Return values
string —get_cart_token_payload()
Get the cart token payload.
public
static get_cart_token_payload(string $cart_token) : array<string|int, mixed>
Parameters
- $cart_token : string
-
The cart token.
Return values
array<string|int, mixed> —validate_cart_token()
Validate the cart token.
public
static validate_cart_token(string $cart_token) : bool
Parameters
- $cart_token : string
-
The cart token.
Return values
bool —get_cart_token_expiration()
Gets the expiration of the cart token. Defaults to 48h.
private
static get_cart_token_expiration() : int
Return values
int —get_cart_token_secret()
Get the cart token secret.
private
static get_cart_token_secret() : string