I’m doing the last phase of my game. There will be three different coin packs in the game, continuously. I built iap into the game and wanted to test the test product ids starting with “android.test. *”. I built iap based on Defold documentation.
Based on the google documentation (https://developer.android.com/google/play/billing/billing_testing#solo) this should work without uploading the app to the play store. The result was an error:
This version of the application is not configured for market billing.
After I have found no meaning for this mistake, I uploaded the game to the play store. Testers then encountered the following error:
Error retrieving information from server. DF-DFERH-01
Since the same error occurred with every tester, I started to suspect the Defold iap solution. After a little reverse engineering I found the cause of the error. The problem is that Google serves fake data for test product ids for both “inapp” and “subs” requests. Defold does not handle this case when the same product id can exist for “inapp” and “subs” requests.
There are four lines in the SkuDetailsThread.run method in the “com.defold.iap.IapGooglePlay” package:
JSONObject products = new JSONObject (); addProductsFromBundle (IapGooglePlay.this.service.getSkuDetails (3, packageName, "inapp", querySkus), products); addProductsFromBundle (IapGooglePlay.this.service.getSkuDetails (3, packageName, "subs", querySkus), products); sr.listener.onProducts (0, products);
In my case, I just wanted to test “inapp” product ids. The first “addProductsFromBundle” call adds the data for the corresponding test product id to the “products” variable. The second “addProductsFromBundle” call (since the test product id is available for both types) overwrites them. The request to Google then goes with a “subs” type that returns an error. If I changed the type from “subs” to “inapp” before the request, the answer did not contain an error and the payment dialog appeared correctly.
I don’t know if I can actually create the same product id for managed products and subscriptions in the play console. If so, it would be useful to distinguish them in Defold.
Currently, this problem only happens to me in test product ids. In real product ids this is not a problem in my case.
However, testing with static responses is not currently working in Defold.