From for a fee UWP App to free (Xamarin) App with In-App products

MatVicMatVic Member ✭✭

Hi all,
I would ask to you what I have to do in this situation.
I have an old UWP App that I have started to porting to Xamarin.
The old App was a App for fee (not free). This new one will be a free App, but with In-App products to purchase.
What I would like to do is that: if a user has purchased the old App, when he/she is going to update you App with the new one, it will get the update and ALL the In-App products.
Is it possible handle that in some way?

Thank you,

Regards

Best Answer

Answers

  • Liêm_NguyễnLiêm_Nguyễn USMember ✭✭✭✭

    You can Right Click on UWP project in Xamarin.Forms. Choose Store\Assosiate App with the Store. And use the same ID of IAP you have created for old app

  • MatVicMatVic Member ✭✭

    Hi Liêm_Nguyễn,
    thank you for your answer.
    I have imagined that I can attach my new App to the old... but how can I check if it is purchased (the old one) if the new App is free?
    Using the CurrentApp.LicenseInformation I could check if the App was purchased (as I did in the old App):

    licenseInformation = CurrentApp.LicenseInformation;
    if (licenseInformation != null && licenseInformation.IsActive)
    {
        // The licens is active....
        // ...but, is it a Trial version?
        int numDays = 1000;
        if (licenseInformation.ExpirationDate != null)
            numDays = (licenseInformation.ExpirationDate - DateTime.Now).Days;
    
        if (licenseInformation.IsTrial || numDays <= 30)
        {
            // Trial version
            int remainingDays = numDays;
            textBlock_LicenseStatus.Text = ResLoader.GetString("LicenzaTrial") + " - " + remainingDays + " " + ResLoader.GetString("Days");
        }
        else
        {
            // Full version
            textBlock_LicenseStatus.Text = "";
        }
    }
    

    Do you mean that I can continue to use the same property (licenseInformation.IsActive and licenseInformation.IsTrial) for check the purchase status also in the new App?

    Thank you,

    Best Regards

  • MatVicMatVic Member ✭✭
    Accepted Answer

    Reading around in the documentation I found this interesting guide about the purchase receipts https://docs.microsoft.com/en-us/windows/uwp/monetize/use-receipts-to-verify-product-purchases#appreceipt.
    What I have to do is simply try to get the receipt: if it is not available it means that the App was not purchased.
    Also, it seems that if the App is free, the IsTrial flag is true... in any case I think to have found a way for check what I need.

Sign In or Register to comment.