How to implement an in-app purchase in Windows Phone 8.1

I am currently new to Windows Phone 8.1. my app requires an in-app purchase, I reference so many links on the internet that I found docs on Windows Phone 8 and Windows Phone 8.1 Silverlight app, not a dedicated doc for Windows Phone 8.1 store app. according to Windows Phone 8 document I'm submitting my app as a beta app and creating one consumable product to test in the currentAppsimulator class. I created one testwindoesphone.xml file and it works great, but I don't know how to build the code with the currentApp class. I am referring to msdn , but every time I encountered error 805a0194 when I was using the CurrentApp class. please direct me to purchase in-app on Windows Phone 8.1 app.

async private void btnCurrentApp_Click(object sender, RoutedEventArgs e)
    {
        LicenceInfo = CurrentApp.LicenseInformation;
        //await CurrentApp.RequestProductPurchaseAsync("PremimumVersion",false);

        if (LicenceInfo.ProductLicenses["PremimumVersion"].IsActive)
        {
            Debug.WriteLine("Already Purchased");
        }
        else
        {
           // await CurrentApp.RequestAppPurchaseAsync(false);
            //await CurrentApp.RequestProductPurchaseAsync("PremimumVersion");
            await CurrentApp.RequestProductPurchaseAsync("PremimumVersion");


            var productLicenses = CurrentApp.LicenseInformation.ProductLicenses;


            MaybeGiveMeGold(productLicenses["Premimum App"], 0);
            //PurchaseResults purchaseResults = await CurrentApp.RequestProductPurchaseAsync();
            //Debug.WriteLine("Purchase Status :: " + purchaseResults.Status);

        }

    }

      

please let me know where to add appid or guid to appxmanifest.

Note. I have already created a store association for the beta app.

Please help me for this, sorry for the bad english

+3


source to share


1 answer


First you will call inside your button the purchase click

await CurrentApp.RequestProductPurchaseAsync("YourPurchase");

      

and inside it, if bought, you would perform inside



if (licenseInformation.ProductLicenses["YourPurchase"].IsActive)
{
}

      

Now you need to make sure that YourPurchase created in your online developer account is running and it will show up even inside your dashboard along with other published apps.

+2


source







All Articles