Search code examples
c#uwpwindows-store-appswin-universal-app

Store ID is in wrong format


Assuming the 12-digit store-id of a durable IAP is 999999999999, license.AddOnLicenses contains the key 999999999999/0010 instead of the expected 999999999999.

Code:

StoreContext store = StoreContext.GetDefault();
StoreAppLicense license = await store.GetAppLicenseAsync();

This is contrary to the docs which say [emphasis added]:

A map of key and value pairs, where each key is the Store ID of an add-on SKU from the Microsoft Store catalog and each value is a StoreLicense object that contains license info for the add-on.

Is this a bug or am I doing something wrong (or understanding the docs wrong)?


Solution

  • where each key is the Store ID of an add-on SKU

    What you are getting is SKU Store ID. It is a 4-character alpha-numeric string that identifies the SKU. An example complete Store ID returned by this property is 9NBLGGH69M0B/000N. Please refer here.

    What you are looking for is product Store ID. It is a 12-character alpha-numeric string, such as 9NBLGGH69M0B. This Store ID is available in Partner Center, and it is returned by the StoreId property of the related StoreProduct object. Please refer here.

    So you need to check StoreProduct.StoreId property.