Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Requests to Microsoft Store APIs always return empty lists of products / subscriptions

We have free UWP app published to the Microsoft Store with non-consumable upgrade add-ons. As new subscription billing model was introduced to public audience recently, we're planning to utilise it by adding subscription plans in the next release.

We also would like to view and manage user-owned add-ons on our backend, and there's relevant documentation to do just that. We followed it closely, but in the end — while trying to get subscriptions for a user, for example — we always get an empty response: { "items": [] }.

Here is what we did briefly, step by step:

  1. Created new app registration in Azure Active Directory.
  2. Associated app registration's identifier with our app through Partner Dashboard.
  3. Created three Azure Active Directory (AAD) tokens for following audience URIs:

    • https://onestore.microsoft.com (used in step 5 for authorization)
    • https://onestore.microsoft.com/b2b/keys/create/collections (used in step 4)
    • https://onestore.microsoft.com/b2b/keys/create/purchase (used in step 4)
  4. Created Microsoft Store ID keys for Collection and Purchase APIs on behalf of our test Microsoft account by calling StoreContext.GetCustomerCollectionsIdAsync and StoreContext.GetCustomerPurchaseIdAsync respectively from client code in our app. To generate each key we used corresponding AAD token from step 3.

  5. Requested products / subscriptions for the user (using authorization AAD token from step 3 and Store ID keys from step 4).

So we're getting 200 "OK" response, but the list is always empty and that is very disappointing and actually a major blocking issue right now for us.

We also can confirm via "Order History" that our aforementioned test Microsoft account owns at least one durable add-on and one subscription. The same result can be checked by calling StoreContext.GetUserCollectionAsync or StoreContext.GetAppLicenseAsync API in the client app — there are one non-consumable product and one subscription indeed.

I posted same question on the official forum, but not sure if we'll get a reply soon, so decided to post it here as well. Note, that similar question is also posted on the forums, but it's not quite clear from the thread whether it was resolved or not.

Has anyone managed to get user purchases from the their backend service? We'll appreciate any guidance, that could make it working for us too.

UPDATE (2018.08.29):

So we have a little bit of progress with the issue. We created new non-free ($0.99) subscription add-on, purchased it and requested subscriptions for a user. Surprisingly enough, a new item appeared in the response!

It's worth to mention that same user already owned several subscriptions that were free of charge, but none of them are on list in the response. And I have never seen a mention in documentation about any restrictions for free subscriptions, saying that they won't be included in returned items.

Anyway, the problem with subscriptions being partially solved, now we can't get info about any non-consumable durable add-on with "Query for products" API, regardless of its price tier — that's also a major problem, so further investigation is needed.

like image 779
mikejd Avatar asked Aug 22 '18 14:08

mikejd


Video Answer


1 Answers

Finally it seems that we resolved the issue!

There're slightly different scenarios for non-consumable durable products and subscriptions, but they're all related to a new required question about personal data collection in add-on properties, which looks like this:

enter image description here

Here are what you need to do:

  1. If you had a non-consumable durable add-on submitted quite a while ago, you need to create a new submission, choose any answer to the aforementioned question and submit it to certification. Once your updated version of product is in the store, try to request user collection of products — it should be included in response now.
  2. If you create a subscription add-on, it looks like you must select "Yes" to the question and provide a privacy policy URL, otherwise it will never appear in the response to "Subscriptions for a user". Also note that based on our experience, it will take longer to take effect compared to non-consumable durable products — up to 24 hours or so after certification finished.

Ok, now it's fine, but I just can't understand why these requirements weren't mentioned by Microsoft straight away in the documentation, leading to many days lost in frustration…

like image 177
mikejd Avatar answered Oct 22 '22 19:10

mikejd