Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
IAB requestProducts() no longer returning subscription products - Gideros Forum

IAB requestProducts() no longer returning subscription products

PaulHPaulH Member
edited October 2017 in General questions
Using Gideros 2017.9, calling iab:requestProducts() with Google I'm getting back all the expected products except for a monthly subscription product. I don't know when that stopped working, but it was working in 2016.8.1. I also don't know if this is an issue with frameworks other than Google.

I see that IAB has been changed in recent Gideros updates. Could one of those changes have effected how the plugin handles subscriptions?

Paul

Comments

  • I've done some more testing, but have still been unable to get Gideros 2017.9 to retrieve subscription products with IAB. I've gone back to using 2016.8.1 and released my update with that.

    If anyone has any insight into why subscriptions no longer work, I'd really appreciate it. A lot of great improvements have been made to Gideros since 2016.8, but for my biggest earning app, I need the subscriptions in IAB.

    Paul
  • Are you sure that was in the iab plugin? There are no signs of subscriptions. There was a different billing library before iab - googlebilling. It may have been in that? That was using v2 of the google payments system. The iab was made to unify apple, google and amazon payments for Gideros and also to update to v3 of the google payments system.
  • Can you post a bit of your code that accesses the plugin so we can see what system you used?
  • PaulHPaulH Member
    edited October 2017
    The relevant code is something like this:
    require "iab"
    	iab = IAB.new("google")
    	iab:setUp(google_store_key)
    	iab:setProducts(
    	{
    		monthly_subscription_product_id = "GooglePlayMonthlySubscriptionProductID",
    		other_product_id = "GooglePlayOtherProductID"
    	}
    	iab:addEventListener(Event.AVAILABLE,
    		function(e)
    			iab:addEventListener(Event.PRODUCTS_COMPLETE,
    				function(e)
    					for i = 1, #e.products do
    						local p = e.products[i]
    						-- make note of id, title, description and price
    					end -- of loop through available products
    				end -- of products complete
    			)
    		end -- of function called when store is available
    	)
  • Here's the code in a text file that preserves the indentation to make it more readable.
    txt
    txt
    code_snippet.txt
    612B
  • The code in iab\frameworks\google\IabHelper.java seems to use Google Billing V3 to handle subscriptions.
  • Could you upload a zip of the previous plugin that worked? I'd like to see if something has changed from that to the current version on github.
  • I'm attaching the Google framework files from the plugin from last summer's version. In the current version of the Google framework, IabHelper.java at line 253 includes some new code for dealing with subscriptions via Google Billing V5. It looks like some significant changes have been made to handling subscriptions.

    Here’s what seems to be broken: The function queryInventoryAsynch() (currently line 686 of IabHelper.java) used to take 3 parameters, and now it takes a fourth. The additional parameter is a list of subscription SKUs. In the past it looks like that method used the same list for subscription and non-subscription SKUs. When queryInvetoryAsynch() is called in the current code (from line 91 of IabGoogle.java) it’s called with null for the list of subscription SKUs. That null parameter gets passed to queryInventory(), which then effectively ignores all subscriptions.

    I don't know the code well enough to propose an appropriate fix, but it would seem that with the changes made so far, queryInventoryAsynch() needs to be called with another SKU list for the subscriptions. As far as I know, there's no mechanism in the plugin interface to specify which SKUs are subscriptions, however. A quick fix might just be to pass the same SKU list in for both subscriptions and non-subscriptions when calling queryInventoryAsynch, trusting Google to respond only to the ones presented accurately.

    Paul

    Likes: SinisterSoft

    +1 -1 (+1 / -0 ) Share on Facebook
  • Here's last year's version of the relevant code.

    Likes: SinisterSoft

    zip
    zip
    iab_plugin_frameworks_2016_8.zip
    24K
    +1 -1 (+1 / -0 ) Share on Facebook
  • Thanks. No rush - I've released my update using the older version of Gideros, but I'd still really like to see this resolved so I can use the current version with this app in the future.

    Paul

    Likes: antix

    +1 -1 (+1 / -0 ) Share on Facebook
  • Just checking in on this - Have you had a look at the changes to subscription support? I'll be publishing an update in the next few weeks, and I'd love it if I could use the current version of Gideros.

    Thanks,

    Paul

    Likes: antix

    +1 -1 (+1 / -0 ) Share on Facebook
  • To look/test I'll have to add subscription to one of my games. I haven't had time to yet...
  • Checking in again... I released my last two updates with a 2016 version of Gideros due to the current version no longer working for subscription products. I have another release coming up. Any chance subscription support can be fixed in the next update?

    Thanks,

    Paul
  • No news, busy making a new game for Christmas. @hgy29 might be able spot if you r suggestion would work?
  • hgy29hgy29 Maintainer
    Hi @PaulH,
    I think if it would be best if you try your proposed fix yourself beforehand (I have no better quick fix to propose). If it does work, then I'll include it in official builds.

    Just change IabGoogle.java in /All Plugins/iab/source/Android/src/com/giderosmobile/android/plugins/iab/frameworks/IabGoogle.java, line 91 as you suggested.
  • I agree - if you already have subscription code in place then you would be the best person to see if that works.
Sign In or Register to comment.