ispiro
ispiro

Reputation: 27633

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)?

Upvotes: 0

Views: 255

Answers (2)

DasiyTian_1203
DasiyTian_1203

Reputation: 1086

Every app and add-on has an associated license that indicates whether the user is entitled to use the app or add-on.Every product in the Store has at least one SKU, and each SKU has at least one availability.

Some publishers have the ability to define their own SKUs.For example, a large game publisher might release a game with one SKU that shows green blood in markets that don't allow red blood and a different SKU that shows red blood in all other markets.

test if they begin with storeId

Yes, it begins with Store Id(this is also sometimes called a product Store ID)

The Store ID for a SKU has the format <product Store ID>/xxxx, where xxxx is a 4-character alpha-numeric string that identifies a SKU for the product. As the picture shown:

enter image description here

For more concepts about product Id and SKU, please refer to documents: Products, SKUs, and availabilities and Store IDs

Upvotes: 1

Tany3450
Tany3450

Reputation: 338

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.

Upvotes: 2

Related Questions