2013-03-04 102 views
0

準備部署我的第二個Windows 8 metro風格的JavaScript應用程序,我很樂意在應用程序購買中加入。 我試着用下面的代碼我從這裏 http://msdn.microsoft.com/en-us/library/windows/apps/hh694067.aspxWindows 8 Metro Inapp購買傻瓜

function appInit() 
{ 
    // some app initialization functions 

    // Get current product object 
    // Execute only one of these statements. 
    // The next line is commented out for testing. 
    // currentApp = Windows.ApplicationModel.Store.CurrentApp; 

    // The next line is commented out for production/release. 
    currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator; 

    // We should have either a real or a simulated CurrentProduct object here. 

    // Get the license info 
    licenseInformation = currentApp.licenseInformation; 

    // other app initializations function 
} 
function buyFeature1() { 
    if (!licenseInformation.productLicenses.lookup("featureName").isActive) 
     { 

     currentApp.requestProductPurchaseAsync("featureName", false).then(
      function() { 
      // 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. 
    } 
    } 

了但似乎沒有發生的事實。知道這是一個新手的問​​題,實現它。但我很高興能否提供完整簡單的工作解決方案。我已閱讀文檔並下載了sample.i也有我的storeproxy.xml文件設置。

回答

1

你可以嘗試改變:

currentApp.requestProductPurchaseAsync("featureName", false).then(

分爲:

currentApp.requestProductPurchaseAsync("featureName", false).done(

這就是我使用,它爲我工作。