Tag Archives: Unity3DIAPS

Unity3D IAPs

I’ve been upgrading my Unity3D system to use the new Unity3D IAPS.  I’d been using a mixture of my own stuff on iOS and Unibill for Android, and wanted to clean up my code and simplify the cross-platform process.

Upgrading my code to reference UnityEngine.Purchasing system wasn’t too hard, but there was one thing I came across that cost me a lot of wasted time, the selected Store on Android.

For an Android build, you have a selection of store fronts you can support – Google Play, Amazon & Samsung.  (They just added a ‘Select Store at Runtime’ option too).

You make this selection using the Editor, but there is nothing to indicate what this selection is.  I had selected Amazon while messing around in the project, and promptly forgot I’d done that.  So when I finally called the code to initialize the purchase tokens, they would never authorize and always return ‘product not found’ error.  Initially I blamed this on the fact it can take Google Play 24 hours to activate a new purchase token, so I took a break…

The next day, the same problem, but I thought maybe the 24 hours wasn’t technically up yet, or maybe Google was taking longer than normal.  I pushed on with some other tasks, and checked the products by running the App from time to time on an Android device and watching ADB for the results – still nothing.

That’s when I remembered the store selector! I selected Google Play, rebuilt and presto, it worked! However, it would have been nice if either (or both)

(a) The Editor menu had a check mark beside the selected store

(b) The system spat out an ADB message with the name of the store it was checking

It also turns out you can select the store via a script, which I decided was the better option for me.



public AndroidStore androidStore;

is a property on a MonoBehaviour which creates a nice drop down in the inspector.