In-App Purchase is a native extension to use iOS Store Kit framework. The extension provides your app functionalities to make in-app purchases, allowing you to offer free app/games and monetize from the users afterward.
The extension has an easy high-level API, with a low-level API to all native methods of Store Kit framework in iOS 6. Some of its features includes hosted contents, downloads, and App Store view. Available in iOS 6.0 and later, Apple can host contents for non-consumables, so your app can have a smaller initial download, and you don’t have to pay for bandwidth or servers to host downloads. Another minor but crucial feature provided is an activity indicator providing feedback and blocking user input during the purchase.
It requires iOS 6.0 SDK to build, but it can be used with iOS 4.3 and up
on devices and iOS Simulator.
Sample
var supported:Boolean = IAP.isSupported; // Initialize the ANE with a list of product IDs, but listen to events first: iap.addEventListener(IAP.INITIALIZATION_DONE_EVENT, function(e:InitializationEvent):void { trace("IAP init'd."); }); iap.addEventListener(IAP.INITIALIZATION_FAILED_EVENT, function(e:InitializationEvent):void { trace("IAP init failed with invalid products: " + JSON.stringify(e.invalidProductIDs)); }); iap.init(["com.mycompany.myapp.product1", "com.mycompany.myapp.product2", ...]); //Buy a product, but listen to events first: iap.addEventListener(IAP.TRANSACTION_DONE_EVENT, function(e:TransactionEvent):void { trace("product is bought: " + e.productID + ", " + e.quantity); // check if the product has any downloads if (e.hasDownload) { // content is already downloaded to this folder var contentFolder:File = File.applicationStorageDirectory.resolvePath("downloads/" + e.productID); } provideContent(); // provide content to user }); iap.addEventListener(IAP.TRANSACTION_FAILED_EVENT, function(e:TransactionEvent):void { trace("purchase failed with error: " + e.error.localizedDescription()); }); iap.buy("com.mycompany.myapp.product1", 2); // buy two of product1 iap.buy("com.mycompany.myapp.product2"); // buy one product2 //This ANE also keeps track of bought products for you. trace(iap.hasBought("com.mycompany.myapp.product1")); //If your app wants a different activity indicator during purchases, you can disable the built-in one: iap.displayActivityIndicator = false;
@as3gamegears https://t.co/yj5Bw5U6 is free and provides the same code interface for iOS and Android!