0

2番目のWindows8メトロスタイルの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

変更してみてください:

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

の中へ:

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

それが私が使用しているものであり、私にとってはうまくいきます。

于 2013-03-18T14:10:10.130 に答える