QInAppProduct Class

A product registered in the store. 更多...

头: #include <QInAppProduct>
继承: QObject

公共类型

enum ProductType { Consumable, Unlockable }

特性

公共函数

QString description () const
QString 标识符 () const
QString price () const
QInAppProduct::ProductType productType () const
virtual void purchase () = 0
QString title () const

详细描述

QInAppProduct encapsulates a product in the external store after it has been registered in QInAppStore and confirmed to exist. It has an identifier which matches the identifier of the product in the external store, it has a price which is retrieved from the external store, and it has a product type.

The product type can be either Consumable or Unlockable . The former type of products can be purchased any number of times as long as each transaction is finalized explicitly by the application. The latter type can only be purchased once.

成员类型文档编制

enum QInAppProduct:: ProductType

This enum type is used to specify the product type when registering the product.

常量 描述
QInAppProduct::Consumable 0 The product is consumable, meaning that once the transaction for a purchase of the product has been finalized, it can be purchased again.
QInAppProduct::Unlockable 1 The product is unlockable, meaning that it can only be purchased once per user. Purchases of unlockable products can be restored using the QInAppStore::restorePurchases ().

特性文档编制

description : const QString

This property holds the description of the product as reported by the external store. This description is returned from the store in the locale language if available.

访问函数:

QString description () const

标识符 : const QString

This property holds the identifier of the product. It matches the identifier which is registered in the external store.

访问函数:

QString 标识符 () const

price : const QString

This property holds the price of the product as reported by the external store. This is the full price including currency, usually in the locale of the current user.

访问函数:

QString price () const

productType : const ProductType

This property holds the type of the product. This can either be Consumable or Unlockable . The former are products which can be purchased any number of times (granted that each transaction is explicitly finalized by the application first) and the latter are products which can only be purchased once per user.

访问函数:

QInAppProduct::ProductType productType () const

title : const QString

This property holds the title of the product as reported by the external store. This title is returned from the store in the locale language if available.

访问函数:

QString title () const

成员函数文档编制

[pure virtual] void QInAppProduct:: purchase ()

Launches the purchase flow for this product. The purchase is done asynchronously. When the purchase has either been completed successfully or failed for some reason, the QInAppStore instance containing this product will emit a QInAppStore::transactionReady () signal with information about the transaction.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 QInAppTransaction .