W3cubDocs

/Qt 5.11

Store QML Type

Access point to the external market place for in-app purchases. More...

Import Statement: import QtPurchasing 1.0
Since: QtPurchasing 1.0

Methods

Detailed Description

When using the Qt Purchasing API in QML, the application should instantiate one Store and then instantiate products as children of this store. The products created as children of the Store object will automatically be queried from the external market place if one is available on the current platform.

The following example registers a store with three products, two consumable products and one unlockable.

Store {
    Product {
        identifier: "myConsumableProduct1"
        type: Product.Consumable

        // ...
    }

    Product {
        identifier: "myConsumableProduct2"
        type: Product.Consumable

        // ...
    }

    Product {
        identifier: "myUnlockableProduct"
        type: Product.Unlockable

        // ...
    }

    // ...
}

Method Documentation

restorePurchases()

Calling this method will cause onPurchaseRestored handlers to be called asynchronously on previously purchased unlockable products. This can be used to restore purchases for unlockable products when the application is run by the same user on multiple devices, or for example if the application has been uninstalled and reinstalled on the device so that the purchase data has been lost.

Note: On some platforms, such as iOS, this will require the user to input their password to launch the restore process. On other platforms, such as Android, it is not typically needed, as the onPurchaseSucceeded handler will be called on any previously purchased unlockable product if the application data is removed.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5/qml-qtpurchasing-store.html