locked
in app purchase problem RRS feed

  • Question

  • Hello MSDN's

    I have implemented In App purchase in my app.

    When I use CurrentAppSimulator class to retrieve LicenseInformation it returns IsTrial and IsActive as True and When I use CurrentApp class the IsTrial returns false that is why my In App Purchase is not working properly on store. Can anyone tell me what is the default return value of IsTrial property and why it is returning wrong value. I have checked that if it is returning wrong value as there could be problem Expiration Date but the Expiration Date is 12/31/9999. I'm not getting what is the problem is? If anyone faced same issue please halp. It will be really appreciated.

    Thanks in advance!

    Regards,

    Rishi


    Please remember to mark the replies as answers it will help others too. --- RishiRaj

    Wednesday, June 19, 2013 5:15 AM

All replies

  • That sounds like correct behavior for a purchased app. See ExpirationDate | expirationDate property :

    maxDate

    The license is active and never expires.

    This occurs after the customer buys the app

    --Rob
    Wednesday, June 19, 2013 6:01 AM
    Moderator
  • Hello Rob

    Can you please tell me the correct steps to be followed while implementing In App purchase functionality?

    Currently implementation -

    On click of Purchase below code gets called.

    LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
                if (!licenseInformation.ProductLicenses["xx.xx.xxxxxx.xxxx.xxxxxxxx.xxxxxx"].IsActive)
                {
                    try
                    {
                        await CurrentApp.RequestProductPurchaseAsync("xx.xx.xxxxxx.xxxx.xxxxxxxx.xxxxxx", false);
                        if (!licenseInformation.IsTrial && licenseInformation.IsActive)
                        {
                            var applicationData = Windows.Storage.ApplicationData.Current;
                            var localSettings = applicationData.LocalSettings;
                            var container = localSettings.CreateContainer(
                                                "TrialVersion",
                                                Windows.Storage.ApplicationDataCreateDisposition.Always
                                                );
                            if (localSettings.Containers.ContainsKey("TrialVersion"))
                            {
                                localSettings.Containers["TrialVersion"].Values["Version"] = "Full";
                            }
                        }
                    }
                    catch (Exception Ex)
                    {
                        CEventLog.Log.Error(Ex.Message.ToString(), Ex.StackTrace.ToString());
                    }
                }

    I am checking the value stored at localsetting i.e. "full" at the next launch of Purchase window.

    If the value of localsetting key is set to "full" then we came to know that app is not purchase yet. Depending on this key we have some functionality implemented.

    Problem statement -

    When we click on purchase button the Windows API shows price of App and then if we click on Cancel button of that API page in that case it sets localsetting value as "full" and functionality depending on key xxx getting failed as the key xxx has value "full".

    Analysis/Findings -

    While investigating this problem, we came to know that the LicenseInformation's IsTrial property returns false therefore it enters in the If block and sets the localsetting's key value as "full". and in case I use CurrentAppSimulator instead of CurrentApp IsTrial returns true. I think the problem resides there.

    Please suggest!

    Thanks in advance!

    Regards,

    Rishi





    Please remember to mark the replies as answers it will help others too. --- RishiRaj

    Wednesday, June 19, 2013 10:02 AM