locked
in-app purchase for app in html/js

    Question

  • below is the code for my in-app purchase of an built using html/js, if the user clicks the button he should be able to make purchase

    HTML code:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>cash</title>

        <!-- WinJS references -->
        <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
        <script src="//Microsoft.WinJS.1.0/js/base.js"></script>
        <script src="//Microsoft.WinJS.1.0/js/ui.js"></script>

        <!-- cash references -->
        <link href="/css/default.css" rel="stylesheet" />
        <script src="/js/default.js"></script>
        <script src="/js/again.js"></script>
    </head>
    <body>
        <p>Content goes here</p>
        <button type="button" onclick="appInit()">Buy</button>
    </body>
    </html>

    again.js code:

    function appInit() {
        currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
        licenseInformation = currentApp.licenseInformation;
        if (licenseInformation.productLicenses.lookup("fullversion").isActive) {
            var full = Windows.UI.Popups.MessageDialog("buy this app & get premium features");
            full.showAsync();
        }
        else {
            var dialog = Windows.UI.Popups.MessageDialog("please buy to get that feauture");
            dialog.showAsync();
        }
        function buyFeauture1() {
            if(!licenseInformation.productLicenses.lookup("fullversion").isActive){
                dialog.showAsync();
                currentApp.requestProductPurchaseAsync("fullversion",false).then(
                    function(){
                    },
                    function(){
                        var anothermsg=Windows.UI.Popups.MessageDialog("something went wrong");
                        anothermsg.showAsync();
                    }
                )}
            else{
                var msg=Windows.UI.Popups.MessageDialog("u already have this feautire");
                msg.showAsync();
            }

        }
    }

    WindowsStoreProxy.xml file code:

    <?xml version="1.0" encoding="utf-16" ?>
    <CurrentApp>
        <ListingInformation>
            <App>
                <AppId>00000000-0000-0000-0000-000000000000</AppId>
                <LinkUri>http://apps.microsoft.com/webpdp/app/00000000-0000-0000-0000-000000000000</LinkUri>
                <CurrentMarket>en-US</CurrentMarket>
                <AgeRating>3</AgeRating>
                <MarketData xml:lang="en-us">
                    <Name>full</Name>
                    <Description>get full version</Description>
                    <Price>10.00</Price>
                    <CurrencySymbol>$</CurrencySymbol>
                    <CurrencyCode>USD</CurrencyCode>
                </MarketData>
            </App>
            <Product ProductId="fullversion" LicenseDuration="0">
                <MarketData xml:lang="en-us">
                    <Name>full version</Name>
                    <Price>1.00</Price>
                    <CurrencySymbol>$</CurrencySymbol>
                    <CurrencyCode>USD</CurrencyCode>
                </MarketData>
            </Product>
        </ListingInformation>
        <LicenseInformation>
            <App>
                <IsActive>false</IsActive>
                <IsTrial>true</IsTrial>
            </App>
            <Product ProductId="fullversion">
                <IsActive>false</IsActive>
            </Product>
        </LicenseInformation>
    </CurrentApp>

    i am not getting any buy the full version message to proceed simulated purchase, please resolve my issue.

     
    Tuesday, July 22, 2014 6:45 AM

All replies

  • Can you explain exactly what you are seeing?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, July 22, 2014 7:22 PM
    Moderator
  • hi matt, i somehow managed to get the in-app purchase simulated calls, my code is now succesfully working when i click continue for "S_OK" option during simulated in-app purchase, but my doubt is do i need to explicitly provide code for other options like E_INVLALIDARG, E_FAIL ??, if so how can i ??, please provide a sample code. 
    • Edited by kranthi88 Thursday, July 24, 2014 1:14 PM
    Wednesday, July 23, 2014 3:23 AM
  • Hi kranthi88,

    I see your similar post has ben resolved, any more question here? http://social.msdn.microsoft.com/Forums/windowsapps/en-US/4cd9ef36-7400-4743-a21c-60ff4706e6f7/how-to-handle-inapp-purchase-simulated-calls?forum=winappswithhtml5#f5a2a701-d225-41da-be15-772e5479ac18

    --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.

    Wednesday, July 30, 2014 8:13 AM
    Moderator
  • no jamles, i just submitted my app to store for certification, waiting for the result.
    Wednesday, July 30, 2014 9:47 AM