Xamarin.InAppBilling problem

I am working with Xamarin.InAppBilling component and keep getting error. The problem is with the override method:

protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) {
  // Ask the open service connection billing handler to process this request
  _serviceConnection.BillingHandler.HandleActivityResult(requestCode, resultCode, data);

  // Ask the open connection billing handler to get any purchases
  var purchases = _serviceConnection.BillingHandler.GetPurchases(ItemType.Product);
  foreach (var purchase in purchases) {
    FufillOrder(purchase);
  }
}

      

When using a reserved id "android.test.purchased"

, a reserved product line, This override method works fine both locally and in the live beta channel of my application. The method is called and the product is executed.

However, when using any live In-App products filled with id string:

 Products = await _serviceConnection.BillingHandler.QueryInventoryAsync(new List<string> {
          "example",
        }, ItemType.Product);

      

this method is not called when the user completes the purchase cycle.

To confuse things even more - in the Android Merchant Console, orders were successfully processed and sent as "Delivered", so no problem.

However, the problem remains the same. The following code does not work for Live products :

protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) {
  // Ask the open service connection billing handler to process this request
  _serviceConnection.BillingHandler.HandleActivityResult(requestCode, resultCode, data);

  // Ask the open connection billing handler to get any purchases
  var purchases = _serviceConnection.BillingHandler.GetPurchases(ItemType.Product);
  foreach (var purchase in purchases) {
    FufillOrder(purchase);
  }
}

      

Orders are not being fulfilled or consumed. I wonder what I threw this on_serviceConnection.OnConnected:

var purchases = _serviceConnection.BillingHandler.GetPurchases(ItemType.Product);
foreach (var purchase in purchases) {
  _serviceConnection.BillingHandler.ConsumePurchase(purchase);
}

      

And it doesn't work for live foods either. They are not consumed. (although, again, it works for android.test.purchased

).

+3


source to share





All Articles