question

GlobalDelight-7823 avatar image
0 Votes"
GlobalDelight-7823 asked ·

How to switch from Trial to In App Purchases in UWP?

My app has currently only Trial and Full License. I want to remove having trial and make the app free but handle full license features with in app purchases and as well having some other in app purchases. That means I created an in app purchase called "full version" and i want user to buy this in order to access all features of the app.
I decided to create a durable in app purchase as "full version" to handle it myself. My Question here is I have already people purchased full version of the app using trial/full version handled by Microsoft Store.
How can I get that information and give users who already purchased the full version?

windows-uwp
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RoyLi-MSFT avatar image
0 Votes"
RoyLi-MSFT answered ·

Hello,​

Welcome to our Microsoft Q&A platform!

>>My Question here is I have already people purchased full version of the app using trial/full version handled by Microsoft Store. How can I get that information and give users who already purchased the full version?

You might need to do some extra work on this. After you cancel the trial/full mode of your app, you might need to check the license of the app using the StoreContext class in the Windows.Services.Store namespace to see if the customer needs to purchase the durable add-on or not.
You could use the following code:

 StoreContext context = StoreContext.GetDefault();
 StoreAppLicense appLicense = await context.GetAppLicenseAsync();

In the StoreAppLicense object you get, you could get the full license data via the ExtendedJsonData property. Its template is here: Schema for StoreAppLicense and StoreLicense.
Then you could check the isActive, isTrial or expiration parameter to check if the current user is a trial before.



· 12 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I am already checking the license using this method.

The problem with this method is,
When i make my application free all the users get the full license.
So, Is there any way to check if the user has purchased using money/coupon or free.

0 Votes 0 · ·

The first thing comes up in my mind is the collection API: Query for products. You should be able to query the product records when setting the producttype parameter as application. Then you could check the acquiredDate parameter. If the data is earlier then the data when you change your app to free. Then it means the customer purchase the app in full version before.





0 Votes 0 · ·

According to what i checked while testing this, the acquiredDate is the date app was acquired by the user not the purchase date.

Here is a sample i created to check the details.

ms-windows-store://pdp/?productid=9PDQR4STKK7X



0 Votes 0 · ·
Show more comments