How to make Android product consumable
<p>I am working on a project, which I need to make consumable. </p>

<p>On clicking on the purchase button, using below code for consumption.</p>

<pre><code>inventory=new Inventory();
mHelper.consumeAsync(inventory.getPurchase(SKU_SUCCESS),mConsumeFinishedListener1);
</code></pre>

<p>But it getting 'Null pointer exception for Purchase here in IabHelper class.</p>

<pre><code>void consume(Purchase itemInfo) throws IabException {
    checkSetupDone("consume");

    if (!itemInfo.mItemType.equals(ITEM_TYPE_INAPP)) {
        throw new IabException(IABHELPER_INVALID_CONSUMPTION,
                "Items of type '" + itemInfo.mItemType
                        + "' can't be consumed.");
    }

    try {
        String token = itemInfo.getToken();
        String sku = itemInfo.getSku();
        if (token == null || token.equals("")) {
            logError("Can't consume " + sku + ". No token.");
            throw new IabException(IABHELPER_MISSING_TOKEN,
                    "PurchaseInfo is missing token for sku: " + sku + " "
                            + itemInfo);
        }
</code></pre>

<p>Please let me know if anyone have Idea regarding this.</p>

<p>The code for consumeAsync()</p>

<pre><code>public void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener) {
    checkSetupDone("consume");
    List&lt;Purchase&gt; purchases = new ArrayList&lt;Purchase&gt;();
    purchases.add(purchase);
    consumeAsyncInternal(purchases, listener, null);
}

public void consumeAsync(List&lt;Purchase&gt; purchases, OnConsumeMultiFinishedListener listener) {
    checkSetupDone("consume");
    consumeAsyncInternal(purchases, null, listener);
}
</code></pre>
