Question

Alright, so I feel like I almost got this working. I have the WP8 store app set up (as beta), the keys are correct in-app. If this is relevant, I am using MonoGame and making the calls in a separate task initiated from the update thread.

When the app launches, I load the license information like this

            mProductList = await CurrentApp.LoadListingInformationAsync();

            foreach (var product in mProductList.ProductListings)
            {
                Debug.WriteLine(string.Format("{0}, {1}, {2}, {3}, {4}",
                  product.Key,
                  product.Value.Name,
                  product.Value.FormattedPrice,
                  product.Value.ProductType,
                  product.Value.Description));
            }

This part works properly (The debug listing part I borrowed from a tutorial so it wasn't written by me). This works, the information appears correctly.

diamond_pack_small, Small diamond pack (beta), $0.00, Consumable, Small diamonds. In a pack.

However, when I call the actual purchase method as illustrated below:

    public async Task<IAPPurchase> BuyProduct(string identifier)
    {
        if (!CurrentApp.LicenseInformation.ProductLicenses.ContainsKey(identifier))
        {
            string receipt = null;
            try
            {
                receipt = await CurrentApp.RequestProductPurchaseAsync(identifier, true);
            }
            catch (Exception e)
            {
                if (Debugger.IsAttached)
                    Debugger.Break();

                return null;
            }

My debugger breaks here with

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

I am at a loss here. Stack trace shows this much:

at Windows.ApplicationModel.Store.CurrentApp.RequestProductPurchaseAsync(String productId, Boolean includeReceipt)

I checked that the product.Key corresponds with the identifier passed on to BuyProduct.

Was it helpful?

Solution

Alright so since I'm using Monogame, I was initiating the call from non-UI thread causing the Catastrophic failure. Using the Dispatcher to marshall the call to the UI thread, life became good again and I could proceed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top