Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In-App Billing v3 - Don't detect refund

p.s. - this suggests it just takes time for the refund to be updated

http://code.google.com/p/marketbilling/issues/detail?id=88#makechanges

But I'm not convinced - I realise they're caching purchase data on the device but 24h is a long time...

Updated to add that more than 24 hours after I cancelled 'test' transactions, those accounts are still licensed!!

Updated again - after 36 hours the app was STILL licensed. I uninstalled and reinstalled and it was STILL licensed!!

Updated AGAIN! - I factory-reset the device, logged-in, installed the app and it was unlicensed...

AND another update - a reply from Google suggests that refunds are processed 'automatically' but can take 'upto 72 hours' to be refreshed on the device - there is no other route to detect a refund, so players get upto 3 days of stuff 'for free' if they refund - erm, OK this is In-App and not App purchase but still, that seems a BIT excessive?


After having waited for about 12 hours and having tried everything suggested here and on similar threads, I was still facing the same issue. What did the trick for me was the following adb command:

adb shell pm clear com.android.vending


You can easily negate the purchase for test purposes by consuming the item.

Using Trivial Drive sample I added the following code in MainActivity.java which will "consume" the premium upgrade when the app starts:

        // Do we have the premium upgrade?
        Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM);
        mIsPremium = (premiumPurchase != null && verifyDeveloperPayload(premiumPurchase));
        Log.d(TAG, "User is " + (mIsPremium ? "PREMIUM" : "NOT PREMIUM"));

        // dss added for test: Consume the premium upgrade for test purposes.
        boolean testConsume = true;
        if (mIsPremium && testConsume) {
            Log.d(TAG, "NOT FOR PRODUCTION: We have a premium upgrade. Consuming it.");
            mHelper.consumeAsync(inventory.getPurchase(SKU_PREMIUM), mConsumeFinishedListener);
            mIsPremium = false;
        } //dss end add

As a bonus you get a free quarter tank of gas when you consume the upgrade just because the sample treats all consumption as gasoline elsewhere. Search MainActivity for "Provisioning" to find where.