Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Billing V3 Subscriptions Issue - A subscription stuck in a state that it cannot be cancelled

UPDATE

More troubleshooting over time has indicated that I have one particular subscription, which is in a stuck state, meaning I can't cancel it and that is somehow causing all the problems. Trying to cancel it whether on browser or on phones or tablets give same following error:

error message

I tried with three accounts. Two new accounts which didn't have this old subscription work fine for my debugging. On my primary account which I had used to subscribe to this item is where the problem happens. So if I could somehow cancel this subscription, I'll be good.

I have a total of three subscription items. I can easily subscribe and cancel the other two with no issues, both on test and regular accounts. However, this particular one, which is over a year old, I can't cancel. This is resulting is all the errors in IabHelper query.

How can I cancel it? Unfortunately due to some mysterious reasons Google doesn't allow to delete subscription items either.


My single purchase works fine but not subscriptions. For last many days I am stuck on this issue where I can't get subscription information for my app, and it fails in:

if (result.isFailure()) {
            Log.v(Constants.TAG, "Failed to query inventory: " + result);
            return;
        }

I have read all the in-app billing related posts everywhere, and have tried everything which could be done, on multiple devices, Alpha and Production versions, on multiple versions of my app, but could't get rid of this error:

Failed to query inventory: IabResult: Error refreshing inventory (querying owned subscriptions). (response: -1003:Purchase signature verification failed)

I understand the issue with blank signature, but now that the app is published in production, still I get the same error in my logs when install it on my devices. So I have now a production app in the Play Store with subscription not working. This was the last desperate step which I took in a hope to get the signature value. It is very unfortunate that there is no real easy way to debug the in-app code.

The code fails in Security.java (which seems to be a common place where it fails for many) in verifyPurchases in:

if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) ||
            TextUtils.isEmpty(signature)) {
        Log.e(TAG, "Purchase verification failed: missing data.");
        return false;
    }

Sadly online help for subscriptions is very little to none. I tried other codes which people have proposed but to no avail. There is no tutorial or example either which deals specifically with subscriptions. All the answers I could find were regarding single purchases only.

my base64 key is fine. No problem with new IabHelper initialization. But when it enters into subscriptions query, it miserably fails. Here is the log:

Querying owned items, item type: subs
10-25 13:52:16.957 7850-7915/com.lifelog24.main D/IabHelper: Package name: com.lifelog24.main
10-25 13:52:16.957 7850-7915/com.lifelog24.main D/IabHelper: Calling getPurchases with continuation token: null
10-25 13:52:16.962 7850-7915/com.lifelog24.main D/IabHelper: Owned items response: 0
10-25 13:52:16.965 7850-7915/com.lifelog24.main E/IABUtil/Security: Purchase verification failed: missing data.
10-25 13:52:16.966 7850-7915/com.lifelog24.main W/IabHelper: In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
10-25 13:52:16.966 7850-7915/com.lifelog24.main D/IabHelper:    Purchase data: 
10-25 13:52:16.966 7850-7915/com.lifelog24.main D/IabHelper:    Signature: 
10-25 13:52:16.984 7850-7915/com.lifelog24.main D/IabHelper: Sku is owned: bus04
10-25 13:52:16.985 7850-7915/com.lifelog24.main D/IabHelper: Continuation token: null
10-25 13:52:16.985 7850-7915/com.lifelog24.main D/IabHelper: Ending async operation: refresh inventory
10-25 13:52:16.993 7850-7850/com.lifelog24.main D/LL24: Query inventory finished.
10-25 13:52:16.993 7850-7850/com.lifelog24.main V/LL24: Failed to query inventory: IabResult: Error refreshing inventory (querying owned subscriptions). (response: -1003:Purchase signature verification failed)

At this point in time I am out of options and would highly appreciate any help which could resolve this issue.

UPDATE May 23 2016

I opened a trouble ticket with Google. Had weeks of back and forth emails, and jumping from one rep to another, but this issue couldn't get resolved. One of my accounts is stuck in a state that it can't be removed from the subscription. Last rep admitted it, and in round about words mentioned that Google In-App billing is a complicated system and such issues are hard to resolve. I'll try to contact them later, in a year or two I guess. My development has severely been affected by this issue as I don't get the right JSON messages back from their end to do my testing and debugging.

like image 416
zeeshan Avatar asked Oct 25 '15 18:10

zeeshan


People also ask

How do you cancel a subscription?

For Android users, go to Google Playstore, tap the menu, followed by 'Subscriptions', Select the 'Cashapp subscription' to be canceled, and click 'cancel subscription'.


1 Answers

I found this answer here In App billing not working after update - Google Store

It says the new verifyPurchase() code is bugged, I believe. Maybe using the old code they're using will help you.

public static boolean verifyPurchase(String base64PublicKey,
        String signedData, String signature) {

if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey)
            || TextUtils.isEmpty(signature)) {
    Log.e(TAG, "Purchase verification failed: missing data.");
        return false;
}

PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);}
like image 100
zuspence Avatar answered Sep 28 '22 23:09

zuspence