Skip to content

Latest commit

 

History

History
157 lines (85 loc) · 2.74 KB

CdvPurchase.Product.md

File metadata and controls

157 lines (85 loc) · 2.74 KB

Class: Product

CdvPurchase.Product

Product definition from a store

Hierarchy

Table of contents

Properties

Accessors

Methods

Properties

description

description: string = ''

Product full description from the store.


group

Optional group: string

Group the product is member of.

Only 1 product of a given group can be owned. This is generally used to provide different levels for subscriptions, for example: silver and gold.

Purchasing a different level will replace the previously owned one.


id

id: string

Product identifier on the store (unique per platform)


offers

offers: Offer[]

List of offers available for this product


platform

platform: Platform

Platform this product is available from


title

title: string = ''

Product title from the store.


type

type: ProductType

Type of product (subscription, consumable, etc.)

Accessors

canPurchase

get canPurchase(): boolean

Returns true if the product can be purchased.

Returns

boolean


owned

get owned(): boolean

Returns true if the product is owned.

Returns

boolean


pricing

get pricing(): undefined | PricingPhase

Shortcut to offers[0].pricingPhases[0]

Useful when you know products have a single offer and a single pricing phase.

Returns

undefined | PricingPhase

Methods

getOffer

getOffer(id?): undefined | Offer

Find and return an offer for this product from its id

If id isn't specified, returns the first offer.

Parameters

Name Type Default value Description
id string '' Identifier of the offer to return

Returns

undefined | Offer

An Offer or undefined if no match is found