Documentation

PA_PurchasableItem
in package

The PuzzleAnywhere PurchasableItem class. It allows for an easy way to display a purchasable item such as a puzzle, puzzle bundle, or subscription.

Table of Contents

$description  : string
A description of the purchasable item.
$ends_at  : string
The datetime when the purchasable item is no longer available.
$external_payment_production_id  : float|null
The external payment production ID.
$external_payment_sandbox_id  : float|null
The external payment sandbox ID.
$fixed_subscription  : bool
Denotes whether the subscription is 'fixed'.
$free  : bool
Denotes whether the purchasable item is freely available.
$id  : int
The purchasable item ID.
$label  : string
The purchasable item parametrized label.
$name  : string
The purchasable item display name.
$price  : float
The purchasable item price.
$purchased  : bool
Denotes whether the active user has purchased the item.
$puzzle  : PA_Puzzle|null
The associated puzzle, if the purchasable item has one.
$recurring  : bool
Denotes whether the purchasable item is a recurring purchase.
$savings  : float
The purchasable item discount.
$selected  : bool
Denotes whether the purchasable item is currently `selected` by the active user.
$subscription  : bool
Denotes whether the purchasable item is a subscription.
$subscription_ends_at  : string|null
The assigned end date for a 'fixed' subscription.
$subscription_interval  : string|null
Denotes how long the subscription can last.
$subscription_starts_at  : string|null
The assigned start date for a 'fixed' subscription.
get_item_by_slug()  : PA_PurchasableItem|null
Retrieves a purchasable item by the item slug.
is_free()  : bool
Denotes whether the `PA_PurchasableItem` is free.
purchasable_item_url()  : string
Retrieves a relative purchasable item URL.
subscription_year_intv()  : int
Parses the year interval of the purchasable item subscription.

Properties

$ends_at

The datetime when the purchasable item is no longer available.

public string $ends_at

The datetime when the purchasable item is no longer available.

$external_payment_production_id

The external payment production ID.

public float|null $external_payment_production_id

This is the PayPal payment ID for recurring payments.

The external payment production ID.

$external_payment_sandbox_id

The external payment sandbox ID.

public float|null $external_payment_sandbox_id

This is the PayPal payment ID for recurring payments.

The external payment sandbox ID.

$fixed_subscription

Denotes whether the subscription is 'fixed'.

public bool $fixed_subscription

A fixed subscription means that the subscription is only available starting at a specific date/ends at a specific date.

Denotes whether the subscription is 'fixed'.

$recurring

Denotes whether the purchasable item is a recurring purchase.

public bool $recurring

Denotes whether the purchasable item is a recurring purchase.

$selected

Denotes whether the purchasable item is currently `selected` by the active user.

public bool $selected

This is publicly available to track purchase progress.

Denotes whether the purchasable item is currently selected by the active user.

$subscription_ends_at

The assigned end date for a 'fixed' subscription.

public string|null $subscription_ends_at

The assigned end date for a 'fixed' subscription.

$subscription_interval

Denotes how long the subscription can last.

public string|null $subscription_interval

Examples: 1.year, 52.week, 2.month`

Denotes how long the subscription can last.

$subscription_starts_at

The assigned start date for a 'fixed' subscription.

public string|null $subscription_starts_at

The assigned start date for a 'fixed' subscription.

Methods

purchasable_item_url()

Retrieves a relative purchasable item URL.

public purchasable_item_url() : string
Return values
string

A relative purchasable item URL.

subscription_year_intv()

Parses the year interval of the purchasable item subscription.

public subscription_year_intv() : int
Return values
int

The year interval of the purchasable item subscription.

Search results