In-App Purchase Air iOS is an AIR Native Extension for In-App Purchase capabilities on iOS devices. The API can be accessed by the singleton AppPurchase.manager which dispatches several events related to the in-app process.

The extension also provides two classes to help abstracting the process, one that describes a product and another that describes a transaction.


import com.adobe.nativeExtensions.AppPurchase;
import com.adobe.nativeExtensions.AppPurchaseEvent;
import com.adobe.nativeExtensions.Product;
import com.adobe.nativeExtensions.Transaction;

import mx.collections.ArrayCollection;
import mx.messaging.Producer;


[Bindable] var arrC = null;

protected function application1_applicationCompleteHandler(event:FlexEvent):void
		AppPurchase.manager.addEventListener(AppPurchaseEvent.RESTORE_COMPLETE,function(e:AppPurchaseEvent):void{trace("Restore COMPLETE");});
				for each(var t:Transaction in e.transactions){
						trace ("Removed: " + t.transactionIdentifier);

	   AppPurchase.manager.restoreTransactions();  // Restore previous successful transactions. Results in UPDATE events

	   var ts:Array = AppPurchase.manager.transactions;
		for each(var t:Transaction in ts){
				// Iterate over in-Que transactions

	   trace ("APP - MUTED " + AppPurchase.manager.muted);  // Check if App Store payments are restricted.

protected function button1_clickHandler(event:MouseEvent):void
	AppPurchase.manager.getProducts(["suite","pepsi","ball"]); // Get the Products info from iTunes Connect. 
																   // (For the ones that you have defined)

protected function onProducts(e:AppPurchaseEvent):void{
	arrC = new ArrayCollection(e.products); // Products received populate the list

   for each(var s:String in e.invalidIdentifiers){ // List of ids for which products could not be retrieved.

protected function onUpdate(e:AppPurchaseEvent):void{
	trace("APP - onUpdate");
	for each(var t:Transaction in e.transactions){ // Iterate over transactions whose status changed
		if(t.state == Transaction.TRANSACTION_STATE_PUCHASED){
			// Verify that this receipt came from apple and is not forged
			 var req:URLRequest = new URLRequest("");
			req.method = URLRequestMethod.POST; = "{\"receipt-data\" : \""+ t.receipt +"\"}";
			var ldr:URLLoader = new URLLoader(req);
					trace("LOAD COMPLETE: " +; // status property in retrieved JSON is 0 then success
					// Provide the purchased functionality/service/product/subscription to user.
					AppPurchase.manager.finishTransaction(t.transactionIdentifier); // Finish the transaction completely
		}else if(t.state == Transaction.TRANSACTION_STATE_RESTORED){
			// Useful for restoring Non-Consumable purchases made by user. Read programming guide for more details.
			if(t.originalTransaction.state == Transaction.TRANSACTION_STATE_PUCHASED){
					trace("Restored Transaction Finish on " + t.transactionIdentifier);

protected function list1_changeHandler(event:IndexChangeEvent):void
		var p:Product = arrC[event.newIndex] as Product;
		AppPurchase.manager.startPayment(p.identifier,1); // Purchase 1 quantity of the selected product.
Air Native Extension, iOS. URL.