locked
Try In-App purchase with CurrentApp

    Question

  • Hi,

    first of all i know that i cant try purchase process with currentapp before submit app to market.

    but submitting process takes lots of time, please tell me is there any problem in my codes.

    so, I tried my in-app purchase with currentappsimulator, than changed it to currentapp. but when i call purchase event i got an error and couldnt see whats error, my app broken, at least it show connecting to store(seen before without publish)

    so here is my code

    private void IMG_puzzle25_PointerReleased(object sender, PointerRoutedEventArgs e)
            {
                LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
                var productLicense = licenseInformation.ProductLicenses["puzzle25"];
                if (productLicense.IsActive)
                {
                    OAL_toast.showToast("you already own this product");
                }
                else
                {
                    stringPurchaseProduct = "puzzle25";
                    sayilariGoster();
                }
            }
    

    private async void purchaseProduct()
            {
    
                ///****
    
                try
                {
                    LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
                    ListingInformation listing = await CurrentApp.LoadListingInformationAsync();
    
                    var PurchasePzl25 = listing.ProductListings["puzzle25"];
                    pricePuzzle25 = PurchasePzl25.FormattedPrice;
                    namePuzzle25 = PurchasePzl25.Name;
                    setPrice();
    
                    if (!licenseInformation.ProductLicenses[stringPurchaseProduct].IsActive)
                    {
                        try
                        {
                            await CurrentApp.RequestProductPurchaseAsync(stringPurchaseProduct);
                            if (licenseInformation.ProductLicenses[stringPurchaseProduct].IsActive)
                            {
                                OAL_toast.showToast(stringPurchaseProduct + " satın alındı.");
                                //OptimeAnimationLib.MsgBox(stringPurchaseProduct + " purchased.");
                                this.Frame.Navigate(typeof(MainPage));
                            }
                            else
                            {
                                //OptimeAnimationLib.MsgBox(stringPurchaseProduct + " was not purchased.");
                                OAL_toast.showToast(stringPurchaseProduct + " satın alınamadı.");
    
                            }
                        }
                        catch (Exception)
                        {
                            OAL_toast.showToast(stringPurchaseProduct + " satın alınamıyor");
    
                        }
                    }
                    else
                    {
                        OAL_toast.showToast(stringPurchaseProduct + " ürününe sahipsiniz");
    
                    }
                }
                catch (Exception ex)
                {
    
                    //OAL_toast.showToast(ex.ToString());when i add this, project broke
                    OAL_toast.showToast("Error\n");
                }

    I hope i can explained what i want to explain. sorry for my English, thanks

    Tuesday, June 10, 2014 4:48 PM

Answers

  • What exceptions are you getting? Exceptions are expected if the app cannot make a network connection to the store and find the published app. The app needs to be able to gracefully handle this scenario.

    Other than that you need to test with CurrentAppSimulator and make sure the product IDs in your simulated license information exactly match the ones registered on the dashboard.

    --Rob

    Tuesday, June 10, 2014 5:28 PM
    Owner
  • thanks for reply Rob,

    you are right, i was disabled the hyper-v, now i remembered, i think error causes beacuse of it. now i will enable hyper-v and try again. error was combase.dll btw.

    thanks.

    edit: error was because of this codes:

    ListingInformation listing = await CurrentApp.LoadListingInformationAsync();


    deleted it and errors gone.


    Tuesday, June 10, 2014 7:29 PM

All replies

  • What exceptions are you getting? Exceptions are expected if the app cannot make a network connection to the store and find the published app. The app needs to be able to gracefully handle this scenario.

    Other than that you need to test with CurrentAppSimulator and make sure the product IDs in your simulated license information exactly match the ones registered on the dashboard.

    --Rob

    Tuesday, June 10, 2014 5:28 PM
    Owner
  • thanks for reply Rob,

    you are right, i was disabled the hyper-v, now i remembered, i think error causes beacuse of it. now i will enable hyper-v and try again. error was combase.dll btw.

    thanks.

    edit: error was because of this codes:

    ListingInformation listing = await CurrentApp.LoadListingInformationAsync();


    deleted it and errors gone.


    Tuesday, June 10, 2014 7:29 PM