繁体   English   中英

Windows Universal App-应用内购买

[英]Windows Universal App - In App Purchases

我一直在(缓慢地)通过应用内购买示例进行工作。 我已经在商店中为我的应用购买了2个应用。 我已将Visual Studio链接到该应用程序。 从请求我的应用内购买进入回调函数时,我终于没有遇到任何错误。

错误:表示应有2的产品有0。

我的代码:

var ProductsARR = [];

var storeContext = Windows.Services.Store.StoreContext.getDefault();
var productKinds = ["Consumable", "Durable", "UnmanagedConsumable"];
storeContext.getAssociatedStoreProductsAsync(productKinds).then(function (addOns) {
    var i;
    if (addOns.extendedError) {
        if (addOns.extendedError === (0x803f6107 | 0)) {
            alert("This sample has not been properly configured.");
        } else {
            // The user may be offline or there might be some other server failure.
            alert("ExtendedError: " + addOns.extendedError.toString());
        }
    } else if (addOns.products.size === 0) {
        alert("No configured Add-ons found for this Store Product.");
    } else {
        for (i = 0; i < addOns.products.size;i++){
            var item = {
                title: addOns.products[i].title,
                price: addOns.products[i].price.formattedPrice,
                inCollection: addOns.products[i].isInUserCollection,
                productKind: addOns.products[i].productKind,
                storeId: addOns.products[i].storeId
            };

            ProductsARR .push(item);
        }
    }
});

是什么导致它认为没有2的应用内购买?

我认为可能引起混乱的唯一一件事是我尚未将实际的xapproduct提交给商店,但是在充实其余代码之前,我不想这样做。 我正在处理应用内购买代码。 那会导致问题吗?

如果不是,可能是什么原因引起了问题。 它在我的仪表板上说应用程序内购买是“实体店”。

您必须将产品提交给商店。 他们经过了认证过程,您应该收到2封电子邮件,写明“您的productX已通过认证”。

如果您不希望此产品出现并且仅可用于Beta测试,请确保将其可用性设置为“在商店中隐藏此应用”。

这是一些信息

我认为可能引起混乱的唯一一件事是我尚未将实际的xapproduct提交给商店,但是在充实其余代码之前,我不想这样做。

您正在使用Windows.Services.Store命名空间,该命名空间不提供可用于在测试过程中模拟许可证信息的类,这不同于Windows.ApplicationModel.Store提供了CurrentAppSimulator类。 因此,您必须发布该应用程序并将其下载到您的开发设备上,才能使用其许可证进行测试。

出于测试目的,此应用程序不一定是您的真实版本,而是满足最低Windows App认证套件要求的基本应用程序。 另外,您可以选择先隐藏该应用程序,以防止客户在测试期间看到您的应用程序。

有关测试指南的更多详细信息,您可以参考“ 测试应用内购买或试用实施”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM