I found I had a collection of various questions and answers about the Windows Store, so I thought today to bring them all into one post.


Question: How do you detect that the user cancels an in-app purchase within requestProductPurchaseAsync? It doesn’t return an error in this case.

Answer: If the user cancels the purchase, the requestProductPurchaseAsync method will still invoke your completed handler, as the dialog was successfully displayed. It only produces an error if the dialog couldn’t be shown. What then determines whether the purchase was successful is whether or not there’s a change in the CurrentApp.licenseInformation object once the dialog is finished. An easy way to do this is to consolidate license handling within the CurrentApp.licenseInformation.licensechanged event. If the in-app purchase goes through, this event will be fired; if the user cancels, there won’t be any event and the app can just continue as usual. It all depends on whether you want to take additional action in response to the cancellation rather than purchase success.

Alternately, within the completed handler for requestProductPurchaseAsync you can get CurrentApp.licenseInformation, then call its lookup(productId) method and check the isActive flag for that in-app purchase.


Question: Is there a cached copy of the app’s licenseInformation object for offline scenarios?

Answer: Yes, license information is always kept up to date for apps, including in-app purchases. Apps do not need to cache license information separately for offline situations.


Question: Are receipts available offline?

Answer: No, you need to be online to access receipts.


Question: Is there a way to get the most recent version of my app in the Store so I can compare the current version that’s running?

Answer: At present the Windows Store and the WinRT APIs don’t support this. That is, you can get the running app’s version from Windows.ApplicationModel.Package.current.id.version, but there isn’t an API to get the version in the Store. Developers who require this for whatever reason typically create a web service endpoint that can respond with that information (clearly you’d update that service’s response when you update the app in the Store). Do be mindful to not pester the user about updates, because the Store already provides a means for that; use it sparingly.


Question: If I have an update command in my app, how do I send the user to the Store to install the update?

Answer: You can do this through Windows.System.Launcher.launchUriAsync with an ms-windows-store: URI (in an instance of Windows.Foundation.Uri). Use of this URI scheme is documented on Linking to your app. To link to your app’s page in the store, use a string created with “ms-windows-store:PDP?PFN=” + Windows.ApplicationModel.Package.current.id.familyName. To go to the overall updates page, use ms-windows-store:Updates.


Question: Can an app hide select in-app purchases? Say that I want to show a certain purchase only a particular date, perhaps to offer a special combination of features A and B together instead of separately. Can I do this, and will it affect certification?

Answer: The Store itself doesn’t show in-app purchases to the user: this is completely under the app’s control. That is, you simply filter the product listings you get from ListingInformation.productListings and show only those you want. In this case your combined A+B product would be a separate product listing that you create through the Store dashboard, but at runtime you’d determine when to display it. It just shows up as another in-app purchase so won’t be an issue with certification.


Question: Along these same lines, if in an update to my app I no longer want to offer A and B separately, just the A+B combination, how do I approach that?

Answer: Because you cannot remove A from the Store (you have no guarantee that all users will update the app), the app update will need to filter out those in-app purchases that it longer wants to appear. Simply said, because each product has its own Id, the updated app can basically have a built-in list of productIds that it just won’t show in its UI.


Question: My app failed certification because of a crash. How do I know what happened?

Answer: In late January 2013, the Store began to include crash reports from the certification process. For details, see Crash reports help you certify your Windows Store app on the Windows Developer Blog.


Comments are closed