HowTo In-App-Purchase

Hi Guys!

I think in-app-purchases were quite a hot subject these days and so, I want to ask, if anyone has done this already and can tell me some hints and tipps or common errors?

I want to do right and not annoy thousands of users with a buggy version.

There are some things unclear for me:

Can I integrate google billing and publish at amazon - the service is capable of telling me if billing is available, so I could supress it for amazon, but will the app start on a kindle device at all?

When users are purchasing something … do I need to store this purchase? Or do the billing service provide me with the information, when I ask them - I’ve read that the dev should NOT ask the billing service every start of the app … so I wonder where i get this information from. If I have to store that by myself … how do you do that in a save manner?

How did you integrate the “shop”? Is there something ready to use from google billing or do I have to implement the whole shop in my app by myself? I ask this, because I have to maintain a list at my developer account - can I access this list from my app or do I have to maintain another list inside of my app?

How stable is google billing? Will it stop my game from working if they have an error? Any known bugs? Does users complain when using google billign?

So many question … sorry, but I cannot find this information on the google sites …

If I get this topic right some day, I will definitely put up a blog post about it, because that seems to be a quite buzzy subject

I need to do the same thing in my next game.

Things to note:

  • amazon is testing in-app billing but it is not generally available at the moment
  • Kindle Fire’s do not have Google Play market installed

Have a look at other games that do it… eg: Zynga’s.

I would be fine to ignore amazon. I am not interested in integrating different IAP for each store out there … that’s the same for amazon as it is for samsung. I like to invest that time more likely into the game itself rather than wokring on all the different IAP systems.

So only google play users will get the benefit of IAP. Sooner or later there will be better systems which may incooperate this different stores OFFICIALLY… later is the problem with current systems … which choose different payment interfaces when available … without approved by google or amazon

I got a promo email from the guys at Zooz some time ago. They claim to offer a secure in-app payment solution with only 3 lines of code. Works with Android, iOS and HTML apps.

Looks quite promising to me - and definitely easier than the Google Play Store IAP solution. Has anyone tried Zooz before, who could give some feedback? I’m not quite sure how this would work with the various app store policies…

I’ve got google in-app billing working in my game DagazEhwas. I used this tutorial here: http://www.anddev.org/advanced-tutorials-f21/simple-inapp-billing-payment-t52060.html

When I tested on the emulator (no market installed so therefor no billing service). You can see the message that in-app billing cannot be started, but it doesn’t break/force close the app. So, if you do it right it should still work no problem, only they will not be able to make any purchases if they do not have the google market on their phone.

There is a restoreTransaction call you can make to check if the person has bought any of your in-app items. You can do this restore transaction on first run of the app (such as in a re-instal or install to a new device). Google doesn’t want you calling this every time the app runs, instead they won’t you to have your own server and keep track of the persons purchases from your server. So once they had bought something and the billing service had confirmed the purchase you upload info to your server to handle any new requests about the purchase. I didn’t take the time/resources to implement my own server. I just called restore transactions on first run of the app. If the app is closed before you get the message back from restore transactions, you could call it again the next time the app runs.

What I did was when they made a purchase and I got the confirmation back from billing service that they had bought one of my level packs, I saved the info in a settings file. So when the app starts it knows what levels they have bought. On a new install I call restore transactions, if the call doesn’t complete I call it again next run of the app. So if someone upgrades their phone and downloads my app again, all there levels they bought will be available.

I don’t know if there is a way to get a list of items from the billing service. There may be, but for my app I only had 3 items, so I didn’t need to worry about it. I believe you need the item id’s from the developer console, so you probably need to update the app’s list of items manually.

I haven’t gotten any complaints so far… I did forget to check for a null value once and released an update that caused a force close, but I quickly found the problem and released a new update. I can see where it would be hard to test if you live in a country where you are not allowed to buy paid apps… So far it’s pretty stable when I’m not doing something to break it myself :blush:

Thank you for your informative post - I really feel a little bit under pressure in giving people the opportunity to buy an adfree version and the concept of in-app-purchases does match my requirements very well.

Sadly, I do not understand why google do not want, that an app checks for purchases on every start and have a built in caching functionality (like they have for licensing)

A reason I could think of would be, that there would be completely different approaches for storing the purchase information (per app) - so the whole process is a 2 tier approach which is much harder to crack … kinda like it xD