0

我准备部署我的第二个 Windows 8 Metro 风格 javascript 应用程序,我很想将其包含在应用程序购买中。我尝试使用从这里获得的以下代码 http://msdn.microsoft.com/en-us/library/windows/apps/hh694067.aspx

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

但似乎什么也没发生。我知道这是一个新手问题。但如果有人能提供一个完整的简单工作解决方案,我会很高兴。顺便说一句,我已经阅读了文档并下载了示例。我也有我的 storeproxy.xml 文件设置。

4

1 回答 1

1

You might try changing:

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

Into:

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

That is what I use and it works for me.

于 2013-03-18T14:10:10.130 回答