locked
CurrentApp.GetAppReceiptAsync() => HRESULT: 0xC03F300A RRS feed

  • Question

  • Hi,

    I have a requirement in my app that is to avoid users to get the same product (in app purchase) more then once, because i have a free app that i want to let people try using a free in app purchase that will expire in a day. The first thing i tryied was:

    string rcp = await CurrentApp.GetProductReceiptAsync(ConstantsLibray.TrialFunctionsStoreID);

    Since i found out that this does not work, in development phase i have used (with success) this:

    string rcp = await CurrentAppSimulator.GetAppReceiptAsync();
                    var xmlDocument = new XmlDocument();
                    xmlDocument.LoadXml(rcp);
                    XmlNodeList productsInfo = xmlDocument.SelectNodes("/Receipt/ProductReceipt[@ProductId='" + ConstantsLibray.TrialFunctionsStoreID + "']");
                    bool HasBoughtTrial = productsInfo.Count > 0;

    but when i change to release the package, my app fails to start, crashing right after this:

    string rcp = await CurrentApp.GetAppReceiptAsync();

    with the exception: HRESULT: 0xC03F300A

    TKS!

    Wednesday, November 13, 2013 10:23 PM

Answers

  • Hi All,

    I talked to the experienced engineers few days ago and I got a clarify for the difference between CurrentAppSimulator and CurrentApp, I'd like to share with you.

    Take a look at the documentation:

    Until the app has been listed in the Windows Store, the CurrentApp object won't work in the app. Use the CurrentAppSimulator to test your app's licensing and in-app purchases while you develop your app. After you test your app and before you submit it to the Windows Store, replace the instances of CurrentAppSimulator with CurrentApp. Your app will fail certification if it uses CurrentAppSimulator.

    We can understand like this: CurrentAppSimulator is only for testing purpose, while in test environment CurrentApp will not work(no matter if your app is on the market or not), that's why your app fail to start with CurrentApp but works fine with CurrentAppSimulator. You have to replace the CurrentAppSimulator with CurrentApp before you package the app for store.

    Hope this help you.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 25, 2013 1:03 AM
    Moderator
  • Well, i ended up sending the App with my old code wrapped in a try catch statement, hoping that it will work when in production... thank you for your time!
    Monday, November 25, 2013 8:50 PM

All replies

  • If you use CurrentAppSimulator.GetAppReceiptAsync(), your app can work fine?

    CurrentAppSimulator is used to instantiate an object that you can  use to get simulated license info during testing. Let's say GetAppReceiptAsync | getAppReceiptAsync method for CurrentApp will fetch the data from server side, if you do not have a developer account, your CurrentApp.GetAppReceiptAsync() will fail to get data and the app must fail to start.

    Besides, I cannot find more detail information about HRESULT:0xC03F300A, do you have some additional information for me.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, November 14, 2013 10:04 AM
    Moderator
  • Yes, with CurrentAppSimulator it works fine... I do have an account, since my App is already on the market and I am developing a new version to it... About that error, im afraid I could not find any info on that code as well. What other info can I provide that would help tracking this error?

    thank you for your help!

    Thursday, November 14, 2013 10:09 AM
  • Ok, I guess the issue might be with the network connection. While testing the app, can you make sure you have a good network connection? get idea from this post: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/b3e956c4-4a77-4669-85b7-ffa55bce57bd/currentapp-vs-currentappsimulator?forum=windowsstore

    Besides, when using CurrentApp, calling LoadListingInformationAsync for example will return an exception if there is no network connectivity. In addition, even with network connectivity, it will return an exception if the app calling the API has not yet been published. This is because the call attempts to load the app metadata from the Store's public catalog. Since it's not published yet, it will not be present and the API will return the exception. So to make sure that everything(eg.AppId) should be same for old version and newer version.

    Or I cannot hardly think of other possibility to cause the issue.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, November 15, 2013 8:23 AM
    Moderator
  • I'm sad to say i think that post (wich i had seen before) doesnt really help me with my apps issue. Since i dont have a internet connection problem and my App is published and its ID is in sync with my Project (i even re-sync it using Project=>Store=>Associate App with the Store to make sure).

    Do see another way for me to ensure a user cannot 'buy' my free in app purchase product more than once? As this would grant the users with the ability to extend this 'trial' for ever and ever...


    Friday, November 15, 2013 4:33 PM
  • bumping to see if anyone will help.
    Wednesday, November 20, 2013 12:41 AM
  • Hi All,

    I talked to the experienced engineers few days ago and I got a clarify for the difference between CurrentAppSimulator and CurrentApp, I'd like to share with you.

    Take a look at the documentation:

    Until the app has been listed in the Windows Store, the CurrentApp object won't work in the app. Use the CurrentAppSimulator to test your app's licensing and in-app purchases while you develop your app. After you test your app and before you submit it to the Windows Store, replace the instances of CurrentAppSimulator with CurrentApp. Your app will fail certification if it uses CurrentAppSimulator.

    We can understand like this: CurrentAppSimulator is only for testing purpose, while in test environment CurrentApp will not work(no matter if your app is on the market or not), that's why your app fail to start with CurrentApp but works fine with CurrentAppSimulator. You have to replace the CurrentAppSimulator with CurrentApp before you package the app for store.

    Hope this help you.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 25, 2013 1:03 AM
    Moderator
  • Well, i ended up sending the App with my old code wrapped in a try catch statement, hoping that it will work when in production... thank you for your time!
    Monday, November 25, 2013 8:50 PM