locked
RequestAppPurchaseAsync crashes

    Question

  • My app crashes in the in-app store purchase dialog after a call to RequestAppPurchaseAsync. It shows the dialog for few seconds and then crashes (silently exits). If I am fast enough I can click Cancel or Buy. Buy dialog crashes the same way when trying to add a payment method. Cancel completes and I get the right status code.

    It works fine in simulation mode. I also tested it with no network connection so I know that it is not a network issue.

    Here is the code

            public async static Task<bool> Buy()
            {
                if (IsTrial || !IsActive)
                {
                    try
                    {
    #if DEBUG
                        await CurrentAppSimulator.RequestAppPurchaseAsync(false);
    #else
                        await CurrentApp.RequestAppPurchaseAsync(false);
    #endif
                        return true;
                    }
                    catch (Exception Ex)
                    {
                        MyEventSource.Log.Error("The upgrade transaction failed." + Ex.Message);
                    }
                }
                return false;
            }


    Wednesday, December 17, 2014 7:21 PM

All replies

  • Hi BohdanR,

    Please use internal discussion channel to get support instead of posting on the forum. Thanks for your understanding.

    Anyway, try to run the in-app purchase sample to see if the sample can works fine with your environment: https://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a

    The code you paste here looks fine, I cannot see any mistake here.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 18, 2014 5:59 AM
    Moderator
  • I don't have access to the internal discussion channel. I tried the sample. My app is based on that. Everything works fine in debug mode using the simulator APIs. This only happens on real phones. I repro'd it on two phones. I suspect that the problem is in the RequestAppPurchaseAsync API and not my code. I can consistently repeat it on my test phone that is connected to the Internet thru WiFi (no carrier).
    Thursday, December 18, 2014 8:59 AM
  • Does the App already exist on the store? You might want to at least submit the App to the Beta Store for testing those APIs. I guess your App is crashing as it's trying to reach the server with the current App ID and as that does not exist there yet it's throwing an exception. At least such an issue was present in the old In-App-APIs for Windows Phone.
    Thursday, December 18, 2014 10:59 AM
  • It was published and is in the store. I could repro it on two phones, both connected to my WiFi router, so maybe it's a firewall issue, but I doubt because the behavior is correct when I have no connectivity, ie I get a proper message from the CurrentApp API. Where can I find more details about the old issue you mentioned? I actually managed to complete an in-app purchase on another phone so I know that logic in my app is correct.
    Thursday, December 18, 2014 3:44 PM
  • Did you find a solution to this?

    I think we're having the same, or at least a similar problem. In our situation, however, it doesn't crash every time. I even managed to complete the purchase on a phone on which it had crashed twice.

    Wednesday, January 07, 2015 7:12 PM