Search code examples
androidin-app-purchasein-app-billing

Testing In App billing from Google


I am testing the in App products from Google. I have purchased the product which can be bought only once in the App. It works fine. but to test various scenarios I have to reset or make it consumed.

Is there is any way to consume it manually ?

Thanks in Advance !


Solution

  • I temporarily made a button in my purchase AlertDialog for "Consume". Here's the code snippet:

            /*builder.setNeutralButton("Consume Purchase", new Dialog.OnClickListener() {//For testing.
    
    
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
    
                consumePurchase();
    
            }
        });*/
    

    You need an instance of IabHelper, of course, to get the consumePurchase() command.

    More info in the docs here.