[UWP]订阅状态不正确 [英] [UWP]Incorrect subscription add on status

查看:108
本文介绍了[UWP]订阅状态不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下示例代码:

https://docs.microsoft.com/en-us/windows/uwp/monetize/enable-订阅附加组件为您的应用程序

,以检查我的用户是否已购买订阅添加。确切的代码位于此消息的底部。它无法正常运行。



场景:

- 用户登录到Microsoft Store应用程序并从应用程序购买订阅(应用内购买)。



接下来,用户尝试使用高级功能。以下示例代码函数用于检查用户是否已购买其中一个订阅。它在这个时候正常工作。



接下来,用户退出微软商店。尝试使用我们的应用程序的高级功能。调用以下函数,它仍然返回true,订阅处于活动状态。



我使用从未购买任何订阅的其他用户登录到其他Microsoft帐户。此函数仍然返回true。由其他用户购买的订阅插件将作为新的
登录帐户的有效订阅插件返回。



Microsoft网站的示例代码:



private async Task CheckIfUserHasSubscriptionAsync()

{

StoreAppLicense appLicense = await context.GetAppLicenseAsync(); < br $>


//检查客户是否有权订阅。

foreach(appLicense.AddOnLicenses中的var addOnLicense)

{

StoreLicense license = addOnLicense.Value;

if(license.SkuStoreId.StartsWith(subscriptionStoreId))

{

if(license.IsActive)

{

//许可证.ExpirationDate属性中有到期日。

返回true;

}

}

}



//客户没有订阅许可。

返回false;

}

解决方案


DS.1,


此行为是设计使然。一旦您在设备中购买产品并在设备中生成许可证,
然后无论您使用哪个帐户,该产品都可以在设备中使用。


最好的问候,


罗伊


I'm using the sample code from:
https://docs.microsoft.com/en-us/windows/uwp/monetize/enable-subscription-add-ons-for-your-app
to check if my user has purchased a subscription add on. The exact code is at the bottom of this message. It does not function correctly.

Scenario:
- The user is logged in to the Microsoft Store app and purchases a subscription from the app (in-app purchase).

Next, the user tries to use the premium features. The below sample code function is used to check if the user has purchased one of the subscriptions or not. It works correctly at this time.

Next, the user logs out of the microsoft store. Tries to use premium features of our application. The below function is called and it still returns true, subscription is active.

I log in to a different Microsoft account with a different user who has never purchased any subscriptions. This function still returns true. The subscription addon which was purchased by a different user is returned as an active subscription addon for the new logged in account.

Sample Code from Microsoft site:

private async Task CheckIfUserHasSubscriptionAsync()
{
StoreAppLicense appLicense = await context.GetAppLicenseAsync();

// Check if the customer has the rights to the subscription.
foreach (var addOnLicense in appLicense.AddOnLicenses)
{
StoreLicense license = addOnLicense.Value;
if (license.SkuStoreId.StartsWith(subscriptionStoreId))
{
if (license.IsActive)
{
// The expiration date is available in the license.ExpirationDate property.
return true;
}
}
}

// The customer does not have a license to the subscription.
return false;
}

解决方案

Hi DS.1,

This behavior is by design. Once you have bought a product in a device and it generated the license in the device, then the product could be used in the device no matter which account that you are using.

Best regards,

Roy


这篇关于[UWP]订阅状态不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆