Packagecom.milkmangames.nativeextensions.ios
Classpublic class StoreKit
InheritanceStoreKit Inheritance flash.events.EventDispatcher

IOS StoreKit Extension



Public Properties
 PropertyDefined By
  storeKit : StoreKit
[static] [read-only] The current instance of the StoreKit singelton.
StoreKit
Public Methods
 MethodDefined By
  
StoreKit(logCallback:Function = null)
Do not call this directly; use StoreKit.create() to initialize or StoreKit.storeKit to get current instance.
StoreKit
  
[static] Initializes the StoreKit Extension.
StoreKit
  
dispose():void
Dispose of Context
StoreKit
  
Checks if purchases allowed on this device (ie, parental controls may prevent them.) Call this after StoreKit.create() and before making any other calls.
StoreKit
  
isSupported():Boolean
[static] Checks if the current platform supports StoreKit.
StoreKit
  
loadProductDetails(productIDs:Vector.<String>):void
Calls the iTunes Connect server for a list of product details (ie, title, price, etc) for the given list of product IDs.
StoreKit
  
purchaseProduct(productID:String, quantity:int = 1):void
Makes a request to purchase a product for the given productID, in the given quantity.
StoreKit
  
Restores previous transactions on the device.
StoreKit
Events
 Event Summary Defined By
  Dispatched When a Product list loading failsStoreKit
  Disapatched when the product list has been loaded.StoreKit
  Dispatched when a purchase has been cancelledStoreKit
  Dispatched when a purchase attempt failsStoreKit
  Dispatched when an item has been successfully purchased, or a purchased item is restoredStoreKit
  Dispatched When a Purchases Restore failsStoreKit
  Dispatched when a restore of purchases has completedStoreKit
Public Constants
 ConstantDefined By
  VERSION : String = 1.0.0
[static] Current API Version
StoreKit
Property Detail
storeKitproperty
storeKit:StoreKit  [read-only]

The current instance of the StoreKit singelton. You must call StoreKit.create() before this property is available.


Implementation
    public static function get storeKit():StoreKit

Throws
Error — if StoreKit.create() was not called before first accessing this property.
Constructor Detail
StoreKit()Constructor
public function StoreKit(logCallback:Function = null)

Do not call this directly; use StoreKit.create() to initialize or StoreKit.storeKit to get current instance.

Parameters
logCallback:Function (default = null)
Method Detail
create()method
public static function create():StoreKit

Initializes the StoreKit Extension. You should check StoreKit.isSupported first to ensure the platform is iOS. StoreKit is a Singleton and you may have only one instance. After creation, you may access the instance through the static property StoreKit.storeKit .

Returns
StoreKit — initialized instance of StoreKit extension interface.

Throws
Error — if StoreKit has already been initialized.
dispose()method 
public function dispose():void

Dispose of Context

isStoreKitAvailable()method 
public function isStoreKitAvailable():Boolean

Checks if purchases allowed on this device (ie, parental controls may prevent them.) Call this after StoreKit.create() and before making any other calls.

Returns
Boolean — true if the running device is capable of making purchases.
isSupported()method 
public static function isSupported():Boolean

Checks if the current platform supports StoreKit. Note that this only determines whether the app is running under iOS (as opposed to Android, Windows, etc.) Use this call before initializing StoreKit in order to confirm that you are on iOS. (So that you can avoid initializing StoreKit on an unsupported platform when building a multi-platform app.)

Returns
Boolean — true if StoreKit is supported; false otherwise.
loadProductDetails()method 
public function loadProductDetails(productIDs:Vector.<String>):void

Calls the iTunes Connect server for a list of product details (ie, title, price, etc) for the given list of product IDs. Even if you do not need to know the details, you must call this before making any calls to purchaseProduct(). On Completion, a StoreKitEvent.PRODUCT_DETAILS_LOADED event will be fired, with a validProducts property containing a Vector array of the StoreKitProduct instances found for your request. Any productIDs you passed in that were not found on the server will be in the invalidProductIds property (a Vector array of Strings) of the same event. If there is an error loading the details, StoreKitErrorEvent.PRODUCT_DETAILS_FAILED will be dispatched instead.

Parameters

productIDs:Vector.<String> — a Vector Array of the product IDs to request details for.

See also

com.milkmangames.extensions.ios.events.StoreKitEvent
com.milkmangames.extensions.ios.events.StoreKitErrorEvent
purchaseProduct()method 
public function purchaseProduct(productID:String, quantity:int = 1):void

Makes a request to purchase a product for the given productID, in the given quantity. iOS will ask the user to confirm the purchase, and enter their password if appropriate; then execute the purchase. If the user cancels the purchase, the StoreKitEvent.PURCHASE_CANCELLED event will be dispatched. If the purchase succeeds, the StoreKitEvent.PURCHASE_SUCCEEDED event will be dispatched. If the purchase fails, the StoreKitErrorEvent.PURCHASE_FAILED event will be dispatched.

Parameters

productID:String
 
quantity:int (default = 1)


Throws
Error — if the quantity is invalid.

See also

com.milkmangames.extensions.ios.events.StoreKitEvent
com.milkmangames.extensions.ios.events.StoreKitErrorEvent
restoreTransactions()method 
public function restoreTransactions():void

Restores previous transactions on the device. Apple reccommends presenting a button to the user that will allow them to run this call. It is intended to be used in cases where the user had previously bought the app, then uninstalled it - losing their saved state- and installed it again. When you call restoreTransactions(), you will receive StoreKitEvent.PURCHASE_SUCCEEDED events for previously completed transactions. When all the previous transactions are done firing their StoreKitEvent.PURCHASE_SUCCEEDED events, StoreKitEvent.TRANSACTIONS_RESTORED will be dispatched. If an error occurs invoking the transaction restore, StoreKitErrorEvent.TRANSACTION_RESTORE_FAILED will be dispatched.

See also

com.milkmangames.extensions.ios.events.StoreKitEvent
com.milkmangames.extensions.ios.events.StoreKitErrorEvent
Event Detail
PRODUCT_DETAILS_FAILED Event
Event Object Type: com.milkmangames.nativeextensions.ios.events.StoreKitErrorEvent

Dispatched When a Product list loading fails

PRODUCT_DETAILS_LOADED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.StoreKitEvent

Disapatched when the product list has been loaded.

PURCHASE_CANCELLED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.StoreKitEvent

Dispatched when a purchase has been cancelled

PURCHASE_FAILED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.StoreKitErrorEvent

Dispatched when a purchase attempt fails

PURCHASE_SUCCEEDED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.StoreKitEvent

Dispatched when an item has been successfully purchased, or a purchased item is restored

TRANSACTION_RESTORE_FAILED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.StoreKitErrorEvent

Dispatched When a Purchases Restore fails

TRANSACTIONS_RESTORED Event  
Event Object Type: com.milkmangames.nativeextensions.ios.events.StoreKitEvent

Dispatched when a restore of purchases has completed

Constant Detail
VERSIONConstant
public static const VERSION:String = 1.0.0

Current API Version