Game Development Reference
In-Depth Information
To retrieve the list of products, we need to retrieve them from the product listing ac-
quired using the LoadListingInformationAsync() method, which is shown as
follows:
concurrency::task<ListingInformation^>
listingTask(CurrentApp::LoadListingInformationAsync());
listingTask.wait();
try
{
auto listing = listingTask.get();
auto products = listing->ProductListings;
auto productDetails =
products->Lookup("PRODUCT_ID");
}
catch (Platform::Exception^ e)
{
// Operation failed, unable to connect maybe?
}
The ListingInformation will provide you with a list of ProductListing objects
(mapped to strings) that provide you with the ID of the product and the price, format-
ted to the locale of the user.
Once the players have chosen what they want to buy, and they have licenses for the
full game, you will want to check if they already have licenses for the product. If they
do, the purchase will fail. To check this, you can retrieve the product licenses from
the LicenseInformation object that you learned how to retrieve earlier. This is
shown in the code snippet that follows:
auto license = CurrentApp::LicenseInformation;
auto productLicense =
license->ProductLicenses->Lookup("PRODUCT_ID");
Just like the application license, this ProductLicense contains an IsActive
property as well as an expiration date so that you can determine if they have valid
and active licenses for the product.
Search WWH ::




Custom Search