我准备部署我的第二个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文件设置。
答案 0 :(得分:1)
您可以尝试更改:
currentApp.requestProductPurchaseAsync("featureName", false).then(
分为:
currentApp.requestProductPurchaseAsync("featureName", false).done(
这就是我使用的,它对我有用。