2015-05-29 72 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类,那么强制发布我的应用程序? –