purchase item in Store using In App purchase

2

I am simply trying to implement in app purchase on my Demo Programm.I am Doing Following Code.

  Guid product1TempTransactionId;
   async void BuyFirstProduct()
   {
       if (!LicenceInfo.ProductLicenses["test_coins10"].IsActive)
       {
           try
           {
               await CurrentAppSimulator.RequestProductPurchaseAsync("test_coins10",false);

               PurchaseResults purchaseResults = await CurrentAppSimulator.RequestProductPurchaseAsync("test_coins10");


               switch (purchaseResults.Status)
               {
                   case ProductPurchaseStatus.Succeeded:
                       product1TempTransactionId = purchaseResults.TransactionId;
                       Debug.WriteLine("Sucess" + product1TempTransactionId.ToString());
                       // Grant the user their purchase here, and then pass the product ID and transaction ID to currentAppSimulator.reportConsumableFulfillment
                       // To indicate local fulfillment to the Windows Store.
                       break;

                   case ProductPurchaseStatus.NotFulfilled:
                       //product1TempTransactionId = purchaseResults.TransactionId;
                       Debug.WriteLine("Fail");
                       break;
                   case ProductPurchaseStatus.NotPurchased:
                       Debug.WriteLine("Not Purchase");
                       break;
               }


           }
           catch (Exception e)
           {
               msg.Content = "" + e.ToString();
               msg.Title = "Error";
                 msg.ShowAsync();

           }

       }
       else
       {
           msg.Content = "You Already Have a This Pack";
           msg.Title = "Error";
           await msg.ShowAsync();
       }
   }

Here test_coins10 is my Product id Which is register in App Store.Here in this Code I am getting Following Error

The operation attempted to access data outside the valid range (Exception from HRESULT: 0x8000000B)

While I am just write Following Code

        await CurrentAppSimulator.RequestProductPurchaseAsync("test_coins10");

its work perfect but Compiler Always going on not purchase block.

Please Note that Product test_coins10 is Consumable

Please reply if any one have any Different idea.

c#
xaml
windows-phone-8.1
asked on Stack Overflow Feb 26, 2015 by Chirag Solanki

1 Answer

0

Reference :- Enable consumable in-app product purchases

Why Exception ?

You are getting The operation attempted to access data outside the valid range (Exception from HRESULT: 0x8000000B) this exception because :-

 await CurrentAppSimulator.RequestProductPurchaseAsync("test_coins10",false);

this method is deprecated in new release. hence your exception. So use :-

CurrentAppSimulator.RequestProductPurchaseAsync("test_coins10");

Why NotPurchaseBlock ?

You are always going to NotPurchaseBLock Because you are not reporting back to Store about the fulfillment of consumable product. This can be achieved by :-

FulfillmentResult result = await CurrentAppSimulator.ReportConsumableFulfillmentAsync("product2", product2TempTransactionId);

Edit :- 'There is a problem completing your requist.try again later.Inquiring minds may find this error code helpful:805a0194'

This can occur because of multiple reasons:- so google it there are lots of results already there..

But for this Error Code :- 805a0194 :-

  1. Problem :- This error occurs when there is a temporary service disruption.
  2. Solution :- Wait a little while and then try again.
  3. Cross check your region

hope it'll help :)

answered on Stack Overflow Feb 26, 2015 by loop • edited Jun 20, 2020 by Community

User contributions licensed under CC BY-SA 3.0