C# 如何在windows phone 8.1中实现应用内购买

C# 如何在windows phone 8.1中实现应用内购买,c#,windows-phone-8.1,in-app-purchase,C#,Windows Phone 8.1,In App Purchase,目前我是windows phone 8.1 c#store应用程序开发的新手。我的应用程序需要应用程序内购买,我在Internet上查阅了太多链接,我只在windows phone 8和windows phone 8.1 silverlight应用程序上找到了文档,没有针对windows phone 8.1应用程序商店的特定文档。根据windows phone 8文档,我将我的应用程序作为beta应用程序提交,并创建一个耗材产品,用于在currentAppsimulator类中进行测试。我创建了

目前我是windows phone 8.1 c#store应用程序开发的新手。我的应用程序需要应用程序内购买,我在Internet上查阅了太多链接,我只在windows phone 8和windows phone 8.1 silverlight应用程序上找到了文档,没有针对windows phone 8.1应用程序商店的特定文档。根据windows phone 8文档,我将我的应用程序作为beta应用程序提交,并创建一个耗材产品,用于在currentAppsimulator类中进行测试。我创建了一个testwindoesphone.xml文件,工作正常,但我不知道如何使用currentApp类构造代码。我已经参考了,但每次我在使用CurrentApp类时发现805a0194错误。请指导我在我的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的位置

注意:我已经完成了测试版应用的商店关联


请帮我解决这个问题,抱歉英语不好

首先,您将在您的购买点击按钮内呼叫

await CurrentApp.RequestProductPurchaseAsync("YourPurchase");
在它里面,如果你购买了它,你会在里面执行

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

现在,您需要确保您在在线开发者帐户中创建的购买正在运行,它甚至会与其他发布的应用一起显示在您的在线仪表板中。

感谢Jerin的回复,但我仍然收到相同的错误。我的问题是如何在测试版应用中测试应用内购买?有办法吗?请让我知道在哪里放置我从开发者帐户仪表板找到的AppId或GUID。请帮我解决这个问题。谢谢您可以使用Wait CurrentAppSimulator.RequestAppPurchaseAsync(“YourPurchase”)进行测试。这将为所有人返回true。记得把它注释掉,然后用原来的。你现在不需要app token一旦上传你的应用,你将收到一个选项add-in-app product在那里你指定你的产品名称记住它应该与代码中使用的相同并指定价格。因此,如果我想使用currentApp类,则必须发布我的应用程序?是的,因为只有它才允许你在-应用程序产品Hey jerin工作正常谢谢我的产品经久耐用,所以工作正常。你对消耗品有什么想法吗?如何管理?