Class TInAppProduct

Unit

Declaration

type TInAppProduct = class(TObject)

Description

A product that can be bought by in-app purchases (TInAppPurchases).

Hierarchy

  • TObject
  • TInAppProduct

Overview

Methods

Public function Price(const ValueWhenUnknown: string = 'loading...'): string;

Properties

Public property Name: string read FName;
Public property PriceRaw: string read FPriceRaw;
Public property Title: string read FTitle;
Public property Description: string read FDescription;
Public property PriceAmountMicros: Int64 read FPriceAmountMicros;
Public property PriceCurrencyCode: string read FPriceCurrencyCode;
Public property Owns: boolean read FOwns;
Public property SuccessfullyConsumed: boolean read FSuccessfullyConsumed write FSuccessfullyConsumed;

Description

Methods

Public function Price(const ValueWhenUnknown: string = 'loading...'): string;

The price, as a string in local user currency, with most unusual characters replaced with ASCII (so it should work reliably with any font), and with special value if not received yet.

See also
PriceRaw
Price, as a string in local user currency.

Properties

Public property Name: string read FName;

Short product identifier, uniquely identifying it in the store.

Public property PriceRaw: string read FPriceRaw;

Price, as a string in local user currency. Empty before receiving information about the product from the store. This may contain various UTF-8 local characters used to describe currency, which do not have to be supported in all fonts.

Use Price to display the price as a "safe" string, with most unusual characters replaced with ASCII (so it should work reliably with any font), and with special value if not received yet.

Public property Title: string read FTitle;

Title of the product, as defined in the store. Empty if not known yet. May be translated to current user language.

Public property Description: string read FDescription;

Description of the product, as defined in the store. Empty if not known yet. May be translated to current user language.

Public property PriceAmountMicros: Int64 read FPriceAmountMicros;

Price in micro-units, where 1,000,000 micro-units equal one unit of the currency. 0 if not known yet.

Public property PriceCurrencyCode: string read FPriceCurrencyCode;

ISO 4217 currency code for price. Empty if not known yet.

Public property Owns: boolean read FOwns;

Is the product owned now. Use this for non-consumable items (things that user buys, and then "owns" for the rest of his life).

Caution: this may not be up-to-date knowledge. Call TInAppPurchases.RefreshPurchases to refresh it (on Android, this happens automatically on app launch; but on iOS, it cannot be done automatically, as it requires logging to AppStore – this is also explicitly said in Apple docs). Watch for TInAppPurchases.Owns and TInAppPurchases.OnRefreshedPurchases then.

Do not depend on this for consumables (use SuccessfullyConsumed for them, and be sure to call TInAppPurchases.SuccessfullyConsumed from TInAppPurchases.Owns for them).

Public property SuccessfullyConsumed: boolean read FSuccessfullyConsumed write FSuccessfullyConsumed;

Item was consumable, and was just consumed. We should "provision" it now, which means that we should set SuccessfullyConsumed:=false, and perform whatever is necessary upon consuming — e.g. continue the game or increase player's gold.


Generated by PasDoc 0.16.0-snapshot.