1
votes

I'm going to give a fairly lengthy explanation in case others run across this same problem...

I am implementing Google in-app billing in my Android app and intend to offer "subscriptions" for the application users. I installed and coded Google's In-App Billing version 3 (IAB V3) and got everything working using Google's test account. Then I set up the product in the developer dashboard and changed the SKU in the code to point to my new subscription product. Rolled it out only to get "item not found" messages when you try to purchase the subscription. Searched the forums and saw lots of people saying "just, wait a few hours and it'll start working". Well I waited overnight and it still errored with "item not found". I then realized that IAB V3 does not support subscriptions - Doh!

I need to rewrite using IAB V2. In the SDK manager, I only see "Google Play Billing Library - 3". How do I install version 2 so I can get in-app billing subscriptions? I have deleted Google Play Billing Library version 3 in the SDK manager and refreshed. "Obsolete" is checked and it still does not offer version 2 for installation.

3
Woah, are you saying the test account of IAB 3 supoorts subscriptions but the production version does not? How did "everything work" in the test account?Ameen
Brian's right V3 only supports 'managed products'Blundell

3 Answers

2
votes

I had the same problem and I was actually using V2 and switched to V3. The difference between V2 and V3 is like night and day, I would never go back. V3 is much simpler to understand and use.

You can implement custom subscriptions in V3 by simply not consuming until x days have gone by. Then consume the item and prompt your user to buy a new x day subscription. Downside is you must ask user to buy subscription again.

V3 subscriptions will be available very soon so when they are, you can easily update your code and upload the new version.

Sample code:

    IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() 
    {
      public void onQueryInventoryFinished(IabResult result, Inventory inventory) 
      {
        if(inventory.hasPurchase("android.test.purchased")) 
        {
          java.util.Date expirationDate = your expiration Date;
          java.util.Date purchaseDate   = new java.util.Date(inventory.getPurchase("android.test.purchased").getPurchaseTime());

          if(purchaseDate.compareTo(expirationDate)<=0) //expired
          {
            mHelper.consumeAsync(inventory.getPurchase("android.test.purchased"), mConsumeFinishedListener);
            mySharedPrefs.edit().putBoolean("isSubscribed",false).commit();
          }
       }
     }
   };
0
votes

Not sure why your SDK manager can't find it I still have it because I had it originally.

Here's a zipped version for you:

http://blog.blundell-apps.com/wp-content/uploads/2012/02/in-app-billing-v02.zip

You can unpack this into:

android-sdk-macosx/extras/google/play_billing/in-app-billing-v02

There are alternate choices to the Google Play demo, my tutorial being one of them :-)

http://blog.blundell-apps.com/simple-inapp-billing-payment/

and robot media have a library:

http://www.robotmedia.net/2011/06/android-billing-library-in-app-billing-made-simple/

(what I mean is you can get the SDK code from other places apart from the SDK-Manager)

0
votes

In case you haven't yet rolledback , Looks like IAB V3 now started supporting subscriptions

http://developer.android.com/google/play/billing/billing_overview.html