Forum Libraries, Components, and Plugins

OnProductPurchaseCompleted issue

In OnProductPurchaseCompleted event what response code indicates that was successful purchase?


  • KMullinsKMullins USMember, Xamarin Team Xamurai

    First, I am assuming you are using the Xamarin.InAppBilling component. Is so there are a couple of things to check.

    1) Ensure that you are calling the HandleActivityResult method of the BillingHandler in the OnActivityResult method of the Activity that initiated the purchase. See:

    protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
        // Ask the open service connection's billing handler to process this request
        _serviceConnection.BillingHandler.HandleActivityResult (requestCode, resultCode, data);
        // TODO: Use a call back to update the purchased items
        // or listen to the OnProductPurchaseCompleted event to
        // handle a successful purchase

    2) With that in place monitor the InAppBillingProcessingError event of the BillingHandler. It will be raised if there are any issues with the purchase.

    3) If OnProductPurchaseCompleted event is raised then the product or subscription was successfully processed by Google Play Services.

    4) The OnPurchaseFailedValidation event will be raised if the product does not validate after purchase.

    You can compare the PurchaseState property of the Purchase object to the properties of the BillingResult static class to decode.

    Here it what it breaks down to however:

    • OK - 0
    • UserCanceled - 1
    • BillingUnavailable - 3
    • ItemUnavailable - 4
    • DeveloperError - 5
    • Error - 6
    • ItemAlreadyOwned - 7
    • ItemNotOwned - 8

    Please let me know if you need anything else.


Sign In or Register to comment.