Windows.Services.Store: How can I find out if a user has unsubscribed from my in-app purchased subscription?

Sjors Miltenburg 6 Reputation points
2022-10-31T14:48:15.65+00:00

My app is free to install with a subscription that can be bought as an in-app purchase.
With the following code I can find out if a user currently is entitled to the subscription that they purchased in-app.
I would also like to know (to show to the user) if they unsubscribed.
I was unable to find this information.

using Windows.Services.Store;  
StoreContext _context = StoreContext.Default;  
var appLicensesQueryResult = await _context.GetAppLicenseAsync();  
var appLicenses = appLicensesQueryResult.AddOnLicenses.Values.ToList<StoreLicense>();  
var monthlySubscriptionLicense = appLicenses.FirstOrDefault(x => x.SkuStoreId.StartsWith(_monthlySubscriptionSkuStoreId));   
if (monthlySubscriptionLicense != null)  
{  
  HasSubcription = monthlySubscriptionLicense.IsActive;  
  ExpirationDate = monthlySubscriptionLicense.ExpirationDate.UtcDateTime;  
}  
Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 16,146 Reputation points Microsoft Vendor
    2022-11-01T09:02:29.86+00:00

    Hello @Sjors Miltenburg ,
    Welcome to Microsoft Q&A!

    There is currently no API to find user unsubscribed information in UWP.

    I'd suggest you submit a feature request about this feature in the Feedback Hub.

    You could find the Feedback Hub in the Start Menu.

    Please select Developer Platform->API Feedback as the category when you submit your request.

    The related team will check the request.

    Thank you.
    Junjie


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments