Store QML Type

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

import 语句: import QtPurchasing 1.12
Since: QtPurchasing 1.0

方法

详细描述

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
        // ...
    }
    // ...
}
					

方法文档编制

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.

注意: 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.