divillysausages divillysausages - 2 months ago 14
Android Question

Google IAB bizarre flow change

Recently when testing in-app purchasing in our Unity game, the flow from Google Play has changed. We're using the In-App Purchasing lib that comes with Unity itself.

When the purchase is launched, instead of the green "Buy" button, I get a grey one:

enter image description here

And whenever the purchase is completed, instead of a "Payment successful" dialog, I get a "You've added X to your library":

enter image description here

Some other additions:


  • No transaction ID is returned with the purchase

  • In the mail from Google about the transaction, the order number is coming in as a string of random chars rather than an normal transaction: e.g. "Order number: onhgdhidhdablpedjbjjibck" or "Order number: pgaeenegbjfmjhojijgahhhd". Previous successful transactions would have a transaction ID like "Order number: GPA.1345-9954-0950-90739"

  • When I look at the Order History in Google Play > Account > Order History, the transactions that worked from a few days ago (before the 23rd) are all marked with a price, while these new ones (23rd) are marked with a price €0.00:



enter image description here

All our products are marked as consumables, and I haven't actually touched the code since it was originally developed (when it worked). I'm not even sure what triggers the "You've added X to your library" flow.

I built a separate project apart with one product of type Consumable, Nonconsumable, and Subscription, and they all returned the same dialog.

With the same APK, it will give normal behaviour on some devices, but this strange behaviour on others (hence we can't release it as we're not sure if it's just us or if the public will hit the same problems). For example, on an Android 5.0 device, it will show this behaviour, while on a 5.1 it won't, while on a 6.0 it will (NOTE: all 3 devices previously showed correct functionality).

I've also tested whether it has to do with being an alpha tester, or being listed as having free purchases, but it doesn't seem to matter. I've also downloaded the previous version (which doesn't use Unity IAPs) and it shows the same bugged behaviour.

Does anyone know what's going on here? It seems more related to Google Play that to Unity

Answer

Okay, this seems to be related to a change in how Google Play handles test transactions (i.e. transactions for alpha/beta users who won't pay)

From a mail from Google Play:

Hello Google Play Developer,

Beginning June 20, 2016, we’ll be making a change to test purchases for one-time in-app purchases (IAPs).

Previously, test purchases for one-time IAPs generated order IDs. Starting June 20, 2016, one-time IAPs will not generate order IDs and will not appear in the Merchant Center. This behavior already applies to subscription IAPs.

You can learn more about testing in-app billing in the Android Developers Help Center (which will be updated with the information above on June 20).

Thanks for supporting Google Play,

The Google Play Team​

On the page itself, there's a note:

Note: For test purchases, leave the orderId field blank. You can use the purchaseToken field to identify test purchases.​

I've yet to find an example of how to actually use the purchaseToken to validate that; the purchase token is either encrypted or compressed base64.

The guys at Unity are working on a fix: http://forum.unity3d.com/threads/bizarre-iap-behaviour-on-android.412981/#post-2698038

TL;DR: this affects sandbox purchases only and doesn't affect the live app

Comments