如何在Windows Phone 8.1中实现应用内购买

3

我目前是新手在Windows Phone 8.1 c#商店应用程序开发中。我的应用程序需要内购,我在互联网上参考了很多链接,但我只找到了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应用程序中启用内购。

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应用程序完成了商店关联。

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

1个回答

2
首先,您需要在购买按钮内部进行调用。
await CurrentApp.RequestProductPurchaseAsync("YourPurchase");

如果它被购买,你会在其中执行内部操作。

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

现在,您需要确保您在线开发者帐户中创建的YourPurchase正在运行,并且它将与您发布的其他应用程序一起显示在您的在线仪表板中。请注意保留HTML标签。

您IP地址为143.198.54.68,由于运营成本限制,当前对于免费用户的使用频率限制为每个IP每72小时10次对话,如需解除限制,请点击左下角设置图标按钮(手机用户先点击左上角菜单按钮)。 - Kushal Maniyar
如果我想使用currentApp类,那么必须发布我的应用程序吗? - Kushal Maniyar
只有这样,才能允许您发布应用内产品。 - Jerin
可消耗产品,我没有使用过,因此无法保证正确实施步骤。 - Jerin
如果它确实起作用了,请不要忘记将其标记为答案以帮助其他人。 - Jerin
显示剩余2条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接