QInAppProduct Class
A product registered in the store. More...
Header: | #include <QInAppProduct> |
Inherits: | QObject |
Public Types
enum | ProductType { Consumable, Unlockable } |
Properties
|
|
Public Functions
QString | description() const |
QString | identifier() const |
QString | price() const |
ProductType | productType() const |
virtual void | purchase() = 0 |
QString | title() const |
Detailed Description
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.
Member Type Documentation
enum QInAppProduct::ProductType
This enum type is used to specify the product type when registering the product.
Constant | Value | Description |
---|---|---|
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(). |
Property Documentation
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.
Access functions:
QString | description() const |
identifier : const QString
This property holds the identifier of the product. It matches the identifier which is registered in the external store.
Access functions:
QString | identifier() 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.
Access functions:
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.
Access functions:
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.
Access functions:
QString | title() const |
Member Function Documentation
[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.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also QInAppTransaction.