Product definition from a store

Hierarchy (view full)

Constructors

  • Parameters

    Returns SKProduct

Properties

countryCode?: string

AppStore country this product has been fetched for

description: string = ''

Product full description from the store.

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: string

Product identifier on the store (unique per platform)

offers: Offer[]

List of offers available for this product

platform: Platform

Platform this product is available from

Raw data returned by native side

title: string = ''

Product title from the store.

Type of product (subscription, consumable, etc.)

Accessors

  • get canPurchase(): boolean
  • Returns true if the product can be purchased.

    Returns boolean

  • get owned(): boolean
  • Returns true if the product is owned.

    Important: This value will be false when the app starts and will only become true after purchase receipts have been loaded and validated. Without receipt validation, it might remain false depending on the platform, make sure to store the ownership status of non-consumable products in some way.

    Returns boolean

  • get pricing(): undefined | CdvPurchase.PricingPhase
  • Shortcut to offers[0].pricingPhases[0]

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

    Returns undefined | CdvPurchase.PricingPhase

Methods

  • Find and return an offer for this product from its id

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

    Parameters

    • id: string = ''

      Identifier of the offer to return

    Returns undefined | Offer

    An Offer or undefined if no match is found

  • Parameters

    • valid: ValidProduct
    • decorator: ProductDecorator & OfferDecorator
    • eligibilities: IDiscountEligibilities

    Returns void

  • Parameters

    • eligibilities: IDiscountEligibilities

    Returns void