AndroidInAppPurchase is a native extension for Android to purchase virtual items. It uses Google Play In-app Billing version 3 API, supporting purchase of items, restoration of previously purchased items, consumption of items and subscriptions (not tested).

In order to  buy an item within the application, the developer must invoke a single method, which uses the item id and fires events to inform about success or failure. The restoration and consumption of items are similar.

Sample

import com.pozirk.payment.android.InAppPurchase;
import com.pozirk.payment.android.InAppPurchaseEvent;
import com.pozirk.payment.android.InAppPurchaseDetails;

// initialization of InAppPurchase
_iap:InAppPurchase = new InAppPurchase();

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

_iap.init("YOUR_LICENSE_KEY_FOR_THE_APPLICATION");

...

protected function onInitSuccess(event:InAppPurchaseEvent):void
{
	//you can restore previously purchased items here
}

protected function onInitError(event:InAppPurchaseEvent):void
{
	trace(event.data); //trace error message
}

// making the purchase, _iap should be initialized first
_iap.addEventListener(InAppPurchaseEvent.PURCHASE_SUCCESS, onPurchaseSuccess);
_iap.addEventListener(InAppPurchaseEvent.PURCHASE_ALREADY_OWNED, onPurchaseSuccess);
_iap.addEventListener(InAppPurchaseEvent.PURCHASE_ERROR, onPurchaseError);
_iap.purchase("my.product.id", InAppPurchaseDetails.TYPE_INAPP);

protected function onPurchaseSuccess(event:InAppPurchaseEvent):void
{
	trace(event.data); //product id
}

protected function onPurchaseError(event:InAppPurchaseEvent):void
{
	trace(event.data); //trace error message
}

// getting purchased product details, _iap should be initialized first
_iap.addEventListener(InAppPurchaseEvent.RESTORE_SUCCESS, onRestoreSuccess);
_iap.addEventListener(InAppPurchaseEvent.RESTORE_ERROR, onRestoreError);
_iap.restore(); //restoring purchased in-app items and subscriptions

...

protected function onRestoreSuccess(event:InAppPurchaseEvent):void
{
	var purchase:InAppPurchaseDetails = _iap.getPurchaseDetails("my.product.id"); //getting details of purchase: time, etc.
}

protected function onRestoreError(event:InAppPurchaseEvent):void
{
	trace(event.data); //trace error message
}

// getting purchased and not purchased product details
_iap.addEventListener(InAppPurchaseEvent.RESTORE_SUCCESS, onRestoreSuccess);
_iap.addEventListener(InAppPurchaseEvent.RESTORE_ERROR, onRestoreError);

var items:Array = ["my.product.id1", "my.product.id2", "my.product.id3"];
var subs:Array = ["my.subs.id1", "my.subs.id2", "my.subs.id3"];
_iap.restore(items, subs); //restoring purchased + not purchased in-app items and subscriptions

...

protected function onRestoreSuccess(event:InAppPurchaseEvent):void
{
	var skuDetails1:InAppSkuDetails = _iap.getSkuDetails("my.product.id1"); //getting details of product: time, etc.
	var skuDetails2:InAppSkuDetails = _iap.getSkuDetails("my.subs.id1"); //getting details of product: time, etc.

	var purchase:InAppPurchaseDetails = _iap.getPurchaseDetails("my.purchased.product.id"); //getting details of purchase: time, etc.
}

protected function onRestoreError(event:InAppPurchaseEvent):void
{
	trace(event.data); //trace error message
}

// consuming purchased item
// need to retrieve purchased items first
_iap.addEventListener(InAppPurchaseEvent.RESTORE_SUCCESS, onRestoreSuccess);
_iap.addEventListener(InAppPurchaseEvent.RESTORE_ERROR, onRestoreError);
_iap.restore();
//

...

protected function onRestoreSuccess(event:InAppPurchaseEvent):void
{
	_iap.addEventListener(InAppPurchaseEvent.CONSUME_SUCCESS, onConsumeSuccess);
	_iap.addEventListener(InAppPurchaseEvent.CONSUME_ERROR, onConsumeError);
	_iap.consume("my.product.id");
}
Air Native Extension, Android . URL.