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: http://developer.blackberry.com/air/apis/playbook/net/rim/blackberry/payment/PaymentSystem.html
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: https://developer.amazon.com/sdk/in-app-purchasing/documentation/adobe.html
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 its 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”
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!
SWC was ignored by git, I have added it.
But you can always build an SWC by yourself using AS3 source code.
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!
Yes, it works on Android only.
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
readme.txt is enough, if you know what you are doing.
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.
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!
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.
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.
Great, I’m happy to hear.
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..
Everything works fine, check your code.
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.
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.
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…
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.
No problem. 🙂
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.
Thank you Galaxia, I have already mentioned extension id in README.
I come from China, thank you very much for your ANE, I returned to the Chinese, to show I have been to. thank you!
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();
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?
I have no idea, what can be wrong, check that everything is correct and check your logs.
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.
There is no need to recompile for AIR3.9, only for AIR3.5 and lower.
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.
Do you know what could be the reason?
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…
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.
This event worked fine for me and fired when it should.
My code only fires events, when Google IAP fires.
So, check your code.
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
As I remember, test item works a bit differently, but double check your code first.
Try to add real item and beta-release your app, then you will be able to test real in-app items.
More info here: Testing In-app Billing
Pozirk, thanks alot for yr quick reply !
Thanks a lot for Android-IAP. Maybe someday i might donate you 😉
Thanks for your great work 🙂
You are welcome!
Many thanks for your ANE!
How I can check curent status of payment of user?
var purchase:InAppPurchaseDetails = _iap.getPurchaseDetails(“my.product.id”);
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
So, what is the status, 1 or 0?
Of course volume always 0 (first position I meant)
I hope see volume 1 or 2 but it never displayed
Have you tried with test items first?
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)
Read docs first and try TEST items.
If you find any bug or exception in code, let me know.
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
I have no idea, what is wrong in your code.
ANE was working fine on the date I’ve released it.
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.
the problem was jest that the app was not downloaded from the store! THANKS
Can somebody repack the ANE for last Air 16.0
If yes, please send on Saliery_@mail.ru
You do NOT need to repack ANE.
Read instructions first!
If i disconnect internet initialization of InAppPurchase return INIT_ERROR ???
For me they return INIT_SUCCESS…
I wanna understand where i made error…
Don’t know why, but when i update Air SDK (from 15 to 16) ane. works good))))
Thanks a lot.
_iap.consume(“my.product.id”); – this function restore already purchase product and then you may purchase it once more with _iap.purchase(“my.product.id”, InAppPurchaseDetails.TYPE_INAPP); ???
All works fine!
I use air 3.9. Just follow readme, setup merchant account and sell items with id.
Thanks for nice API.
На здоровье! 🙂
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)
You are welcome!
Подскажите пожалуйста, почему перед вызовом метода consumed нужно обязательно вызывать метод restore? (иначе ошибка из библиотеки “you must do restore first”) В справке гугла, как я понял, сказано, что неоходимо после каждой покупки вызывать только consumed, restore необязательно?..
restore восстанавливает список уже совершённых ранее покупок пользователем, либо получает детали о существующих предметах для покупки из базы данных.
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?
I don’t use this extension anymore and don’t provide support.
You have all the source code though.
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.
I’m not using this ANE anymore, can’t say if it’s working or not.
It works. I am using it with AIR 23.0. Works fine. Thanks Pozirk.