2015-05-29 71 views
3

目前我是在windows phone 8.1 c#store應用開發中新增的。我的應用程序需要在應用程序內購買,我在互聯網上提到了很多鏈接。我在windows phone 8和windows phone 8.1 silverlight應用程序上發現了文檔,沒有針對windows phone 8.1商店應用程序的特定文檔。根據Windows Phone 8文檔我提交我的應用程序作爲測試版應用程序,並創建一個可用產品,在currentAppsimulator類中進行測試我創建了一個testwindoesphone.xml文件並且工作正常,但我不知道如何使用currentApp類構造代碼。我參考了msdn,但每次我在使用CurrentApp類時發現805a0194錯誤。請在我的windows phone 8.1應用程序中引導我進行enalble應用內購買。如何在windows phone 8.1中實現應用內購買

async private void btnCurrentApp_Click(object sender, RoutedEventArgs e) 
    { 
     LicenceInfo = CurrentApp.LicenseInformation; 
     //await CurrentApp.RequestProductPurchaseAsync("PremimumVersion",false); 

     if (LicenceInfo.ProductLicenses["PremimumVersion"].IsActive) 
     { 
      Debug.WriteLine("Already Purchased"); 
     } 
     else 
     { 
      // await CurrentApp.RequestAppPurchaseAsync(false); 
      //await CurrentApp.RequestProductPurchaseAsync("PremimumVersion"); 
      await CurrentApp.RequestProductPurchaseAsync("PremimumVersion"); 


      var productLicenses = CurrentApp.LicenseInformation.ProductLicenses; 


      MaybeGiveMeGold(productLicenses["Premimum App"], 0); 
      //PurchaseResults purchaseResults = await CurrentApp.RequestProductPurchaseAsync(); 
      //Debug.WriteLine("Purchase Status :: " + purchaseResults.Status); 

     } 

    } 

請讓我知道在appxmanifest文件中放置appid或guid的位置。

注意:我已經完成了beta應用商店關聯。

請幫我爲,對不起英文不好

回答

2

首先,你會打電話給您的購買點擊按鈕

await CurrentApp.RequestProductPurchaseAsync("YourPurchase"); 

內,如果裏面的購買,你會內執行

if (licenseInformation.ProductLicenses["YourPurchase"].IsActive) 
{ 
} 

現在您需要確保您在開發者帳戶在線內創建的YourPurchase正在運行,並且它甚至會在網上顯示以及您的其他已發佈應用程序。

+0

謝謝Jerin的回覆,但我仍然得到同樣的錯誤。我的問題是如何測試測試應用程序中的應用程序內購買?有什麼辦法嗎?並請讓我知道從開發人員帳戶儀表板找到的AppId或GUID的位置。請幫我解決這個問題。謝謝您 –

+0

您可以使用await CurrentAppSimulator.RequestAppPurchaseAsync(「YourPurchase」)進行測試。對於所有人都會返回true。請記住註釋並使用原來的。您現在不需要應用程序令牌,只要您上傳應用程序,就會收到應用程序產品的選項添加,您指定的產品名稱應記住它應與代碼中使用的相同,並指定價格。 – Jerin

+0

所以如果我想使用currentApp類,那麼強制發佈我的應用程序? –