Registering Products in Windows Store | Qt Purchasing 5.15.19

- Qt 5.15
- Qt Purchasing
- Registering Products in Windows Store
- Qt 5.15.19 Reference Documentation

# Registering Products in Windows Store

This guide provides a brief introduction to registering an application and its in-app products on Windows Store.

In-App purchasing for WinRT differentiates between two modes:

- `Simulation`: All Windows Store interaction is emulated and controlled via a configuration XML file. A project containing this file will fail certification and cannot be published.
- `Store interaction`: The application talks to the Windows Store directly without any layer in between. This binary can neither be side-loaded nor tested locally. The user has to retrieve the app through the Windows Store itself.

## Using the Simulation Mode

During the development process it is not allowed to interact with the Windows Store directly. Instead, an XML file has to be used, describing the available in-app products and the license of the application itself. Go to the MSDN documentation for more information on the format of this XML file.

This XML file has to be added to the root directory of the application resources and named QtStoreSimulation.xml.

## Using the Windows Store

### Adding In-App Products to Windows Store

In order to access in-app products from your application, you must register them to the Windows Store. Go the the IAPs page and click Create a new IAP.

Fill out the following information about your product:

- Product type – Choose either Consumable or Durable depending on the type of the in-app product. Note that you will not be able to change this later.
- Product ID – An identifier that is used to access the product from your code.
- Pricing and Availability – Price for the product and the geographical areas where it is available.

In-app products will be available once you have published the application.

### Publishing Your Application

In order to test in-app purchases in your application, you first have to publish it. To limit the users who can access the application before it is ready for production, it can be published as either alpha or beta.

## Platform Notes

The Windows Store provides a way to set an application into trial mode and buy the application itself via in-app purchases. To reflect this functionality, the WinRT backend uses the app keyword as an identifier. If a product query for app succeeds, the current license is valid. The product name itself will provide information on the license state of the app and can have the following content:

- `Trial period`: The app is in trial mode and can be purchased.
- `Fully licensed`: The app has been bought.

If a product query for app fails, then either the trial has expired or the license is invalid. Your app should check for this product and react accordingly, for instance by showing a dialog to the user.