Adobe AIR In-app Purchase native extensions

I have spent some time searching for free extensions for all the possible platforms and would like to share my results.
Also, I made my own in-app purchase extension for Android, as I couldn’t find a good and free one.

1. In-app Purchase for Blackberry Playbook.
There is an extension that comes with BlackBerry SDK for Adobe AIR.
API docs:

2. In-app Purchase for iOS.
In-app purchase extension comes with Adobe Gaming SDK

3. In-app Purchase for Amazon Kindle.
It comes with Amazon SDK:

4. In-app Purchase for Android.
I have found two extensions:
First is free extension from Freshplanet, but it is outdated.
Second is from Milkman for $50.
So, I have decide to make my own. 🙂
You can find it here: Adobe AIR In-app Purchase native extension for Android

Hope, it will help someone in their mobile app development.

З.Ы.: InAppPurchase ANE for Android works.
I have made it for myself, but shared (including the source code) with everyone for free.
Please be respectful, if you want me to answer your questions. Thank you.

66 comments on “Adobe AIR In-app Purchase native extensions”

  1. Thanks for you work on the ANE for Android in-app purchase. I’ve been trying to implement it into an app I am creating in Flash Builder, but I get a Native Extension Error when I try to run the project that leads to a runtime VerifyError saying that the InAppPurchase class could not be found. As per your instructions in the readme file, I added the “InAppPurchase.ane” file to my project, but I couldn’t find a .swc file anywhere. I don’t have much experience working with ane’s or swc’s so I’m not really sure what to do about this problem, so any advice would be appreciated. Thanks again for the ANE!

    1. Thanks very much! I still can’t run my project in Flash Builder because of the VerifyErrors, but it works great when I test it on an Android device!

  2. Is there a good example implementation file just like in Amazon and iOS (Adobe Gaming SDK), bundles
    Somehow i didnt find any example except some line of code in read me.txt

    Thanks in advance

  3. Hi, thanks for your work on the in-app purchase extension for android. I am trying to use it, but I’m having some trouble. I have everything set up as instructed in the readme file, but when I try to initialize the in-app purchase it always comes up that _ctx is null. I’m really not sure what I’m doing wrong, so any advice would be appreciated.
    Thanks again.

  4. First of all – thanks for taking effor in making this component.

    Second – I’m having touble using it in my project. My program crashes when i call “init” method of “InAppPurchase” object.

    Can you give me some tips on proper use of your component?

    Thanks in advance!

  5. Andrew, you don’t have ANE connected to your project, google how do to that.

    Darson, most likely the same problem, debug and google first before asking the questions.

  6. Thank you very much for your Android ANE, I was struggling for a few days with the freshplanet version which does not seem to support Google Billing API3. Your version was fully implemented in my project within 2 hours of downloading.

  7. Hello, thank you for and! But I tried it for two days… And when I make purchase, none listener called.. Neither error, nor success and already owned listeners.. I see “Payment successfull” on the screen of my device, but I can’t change game currency amount without listener called. Maybe you know smth about it..

    1. I opened an issue on git. I showed my code. It is the same as your samples. So I don’t think everything works fine. Best wishes though.

    2. Then you do something wrong in some other place.
      Everything works fine for me, check debug logs, and check the rest of your code, not just purchasing.

  8. Hello Pozirk,
    thanks for the ANE.

    You may help me with some questions:
    I noticed that whatever I use as LICENSE KEY in .init(), listener init_succes is always fired. That means the LICENSE is checked only when executing IAP operation (purchase, restore, …) is this right?

    I ask this because my problem is that the ANE never finds my item, so I would like to know if it could be a license issue…

    1. Oh boy, I finally found what I was doing wrong.
      The problem was that I was testing using Run / Debug from Flash Builder.
      Whereas the “Export Release Build” signed version of the apk must be used (with same certificate used on the Store, sounds logic….).
      So the first step is ok, I keep going 🙂

      Thx again for your work, Pozirk.

  9. Hello Pozirk,
    Nice ANE, able to use it after 30 min of download and get to the point “User is not eligible for this purchase”.
    Probably your ANE is working and I just need some work on the google setting part.

    Very easy to use ane if you have implemented other ane before.
    I think people not able to use it as their first ane because the README miss out the extensions part in the xml:


    Just a suggestion.

    Happy weekend

  10. I come from China, thank you very much for your ANE, I returned to the Chinese, to show I have been to. thank you!


  11. I have the License Extension working without problems. But when i try to add this extension it all functions without errors but the init event:

    _iap = new InAppPurchase();

    _iap.addEventListener(InAppPurchaseEvent.INIT_SUCCESS, onInitSuccess);
    _iap.addEventListener(InAppPurchaseEvent.INIT_ERROR, onInitError);


    None of the events work.

    I have added the extension ID properly as well.
    And added the permissions in the application.xml (I have more so maybe there is some conflict?



  12. Hi Pozirk – thanks for your work on the AndroidInAppPurchase ANE – just trying it out. I am using AIR 3.9 and I see your note about recompiling. I tried editing and running the build.bat file but in there you are looking for a android\InAppPurchase\bin directory and that did not come with your zip. I will continue on as it may work without recompiling – not sure. If you could please post the bin folder with its files – or let me know if I am missing something – that would be great. Thanks.

  13. Hi Pozirk,

    First of all, thank you for this great component. I have one problem with it. When I want to execute init() method where I put license key, I’ve got error message and it doesn’t work. I’m getting:

    ArgumentError: Error #3500: The extension context does not have a method with the name init.
    at flash.external::ExtensionContext/_call()
    at flash.external::ExtensionContext/call()

    Do you know what could be the reason?

  14. Thanks – got it working. I posted an instruction page in the Flash to Mobile Facebook group if anyone is interested on how to install and test, etc. I can’t seem to put the link in this comment…

  15. Hi Pozirk

    Your ANE works very well ! Great Job Pozirk !
    The only question I need to ask you is that the function onIAPPurchaseSuccess is fired once the Google Play payment screen is shown, before the actual payment went through. Is there another event listener that is only fired ONLY UPON SUCCESSFUL GOOGLE PLAY PAYMENT ? I think you will have provided for such a listener, so I must have missed out something ?

    Once again, thanks for your good work !
    And hope to hear your reply soon.

    1. Hi Hin!

      This event worked fine for me and fired when it should.
      My code only fires events, when Google IAP fires.
      So, check your code.

    2. Hi again Pozirk,

      I went through my code and every eventlistener for in-app purchase works except onIAPPurchaseSuccess which is fired immediately when the Google Play payment screen is shown instead of after SUCCESSFUL payment. However, I am only testing it in the Google Play test environment. Could it be that only in the production environment then it will work ?

      Thank you once again and

  16. Many thanks for your ANE!
    One question.
    How I can check curent status of payment of user?

    My code:
    var purchase:InAppPurchaseDetails = _iap.getPurchaseDetails(“”);
    debagTextField.text += “\r _purchaseState= ” + purchase._purchaseState // 0 – purchased 1 – canceled 2 – refunded

    Because was displaying always status 1 (purchased). I canceled purchase, refunded it, but status still 0

    1. Oops!
      Of course volume always 0 (first position I meant)
      I hope see volume 1 or 2 but it never displayed

    2. Of course. I published it to an alpha distribution channel. It worked normally. But never was switching to volume 1 (canceled) or 2 (refunded) just I did it.
      Also I don’t understand exactly how I can know user made purchase or not? (for example when user does synchronize app at other device)

  17. Hi i need help
    I’m trying to use this ane but when i test it and click a button to purchase nothing happens…. I’m testing it on the device with usb cable

    thanks so much

    1. ok I made a very small project and i finally managed to arrive to the overlay where it says that I must autenticate but then when I click OK it says that I canceled the action and leave me there.

      -1005 error

    1. If i disconnect internet initialization of InAppPurchase return INIT_ERROR ???
      For me they return INIT_SUCCESS…

      I wanna understand where i made error…

    2. Don’t know why, but when i update Air SDK (from 15 to 16) ane. works good))))
      Thanks a lot.

    3. One questions
      _iap.consume(“”); – this function restore already purchase product and then you may purchase it once more with _iap.purchase(“”, InAppPurchaseDetails.TYPE_INAPP); ???

  18. All works fine!
    I use air 3.9. Just follow readme, setup merchant account and sell items with id.
    Thanks for nice API.

  19. Good job for the android ANE, and thank you
    i was strugling with the one of freshplanet, and got problems with the consumation of product. Your version runs also faster (for showing the dialog box)

  20. Подскажите пожалуйста, почему перед вызовом метода consumed нужно обязательно вызывать метод restore? (иначе ошибка из библиотеки “you must do restore first”) В справке гугла, как я понял, сказано, что неоходимо после каждой покупки вызывать только consumed, restore необязательно?..

    1. restore восстанавливает список уже совершённых ранее покупок пользователем, либо получает детали о существующих предметах для покупки из базы данных.

  21. Hi! Thanks for your efforts. The extension was working fine until recently. Now my app freezes whenever I initialize (init(key)) the InAppPurchase instance. Anything to do with Google Play’s updated security requirements?


    1. I don’t use this extension anymore and don’t provide support.
      You have all the source code though.

  22. Hi,
    Does this ANE work for AIR 23.0? the ane gets initialized successfully
    but when I tap on the button that calls the iap.purchase(id, type) method, nothing happens.

Leave a Reply

DISCLAIMER: The content in this blog represents the opinion of the author. No information here should be used for any purpose except for entertainment.