Search code examples
windowsuwpin-app-purchaseazure-active-directorywindows-store

How to determine auto renewal preference change in Microsoft Store Subscription purchases through GetSubscriptionsForUser API?


We want to use this API https://learn.microsoft.com/en-us/windows/uwp/monetize/get-subscriptions-for-a-user to be called from a renewal job to identify if the user's subscription has been renewed or not as expected to extend the license in our system. We want to detect the following scenarios:

  1. User's subscription is renewed successfully for the next cycle.
  2. User's subscription failed to renew successfully because of billing failure (Current Active)
  3. User's subscription failed to renew successfully because of billing failure (Past expiration)
  4. User opted out of renewal and the subscription expired.
  5. User opted out of next renewal but current subscription is active.

We can determine the states 1-4 as per the documentation but how to determine for #5. We have the following understanding for the four states, based on the value of recurrenceState property:

  1. User's subscription is renewed successfully for the next cycle - Active
  2. User's subscription failed to renew successfully because of billing failure (Current Active) - InDunning
  3. User's subscription failed to renew successfully because of billing failure (Past expiration) - Failed
  4. User opted out of renewal and the subscription expired - InActive
  5. User opted out of next renewal but current subscription is active - ?

Solution

  • The response includes a autoRenew field. If the autoRenew field is set to false AND state is Active it results into the #5 scenario.