locked
how to check whether the in-app purchase process succeeded or failed in windows 8 store apps built with html/js?

    Question

  • how can i know whether the in-app purchase process succeeded or failed in windows 8 store apps built with html/js to test during in-app purhase simulation
    Wednesday, July 30, 2014 3:23 AM

Answers

  • Hi,

    You can use the following code to detect whether in-app purchase process succeeded or failed:

    function buyFeature1() {
        if (!licenseInformation.productLicenses.lookup("featureName").isActive)
        {
            // The customer doesn't own this feature, so 
            // show the purchase dialog.
    								
            // note: currentApp is a reference to CurrentAppSimulator from a previous declaration
            currentApp.requestProductPurchaseAsync("featureName", false).then(
                function () {
                    //Check the license state to determine if the in-app purchase was successful.
                }, 
                function () {
                    // The in-app purchase was not completed because 
                    // there was an error.
                });
        } 
        else
        {
            // The customer already owns this feature.
        }
    }
    
    

    And the licenseInformation.productLicenses.lookup("featureName").isActive can determine whether the in-app purchase was successfull or not.

    Please refer to the document below to get more information:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh694067.aspx

    Best Wishes!


    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. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Marked as answer by kranthi88 Friday, August 1, 2014 1:49 PM
    Thursday, July 31, 2014 8:17 AM