Boris Salimov
Boris Salimov

Reputation: 693

How to discover In-App Purchase price in the WP8.1?

Is there any way to discover in-app purchase price before navigating to confirmation of in-app purchase? I want to place price in my app in the custom interface. And I want to get price dynamically through Windows Phone Store or In-App Purchase API.

Upvotes: 1

Views: 52

Answers (1)

aman shivhare
aman shivhare

Reputation: 334

 try
{
    //StoreManager mySM = new StoreManager();
    ListingInformation li = await Store.CurrentApp.LoadListingInformationAsync();

    foreach (string key in li.ProductListings.Keys)
    {
        ProductListing pListing = li.ProductListings[key];
        System.Diagnostics.Debug.WriteLine(key);

        string status = Store.CurrentApp.LicenseInformation.ProductLicenses[key].IsActive ? "Purchased" : pListing.FormattedPrice;

        string imageLink = string.Empty;

        picItems.Add(
            new ProductItem {
                imgLink = key.Equals("molostickerdummy") ? "/Res/41.png" : "/Res/18.png",
                Name = pListing.Name,
                Status = status,
                key = key,
                BuyNowButtonVisible = Store.CurrentApp.LicenseInformation.ProductLicenses[key].IsActive ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible
            }
        );
    }

    pics.ItemsSource = picItems;
}
catch (Exception e)
{
    System.Diagnostics.Debug.WriteLine(e.ToString());
}

Upvotes: 2

Related Questions