| Package | com.milkmangames.nativeextensions.ios |
| Class | public class StoreKit |
| Inheritance | StoreKit flash.events.EventDispatcher |
| Property | Defined By | ||
|---|---|---|---|
| storeKit : StoreKit [static] [read-only]
The current instance of the StoreKit singelton. | StoreKit | ||
| Method | Defined 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 | ||
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. | 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 | ||
restoreTransactions():void
Restores previous transactions on the device. | StoreKit | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched When a Product list loading fails | StoreKit | |||
| Disapatched when the product list has been loaded. | StoreKit | |||
| Dispatched when a purchase has been cancelled | StoreKit | |||
| Dispatched when a purchase attempt fails | StoreKit | |||
| Dispatched when an item has been successfully purchased, or a purchased item is restored | StoreKit | |||
| Dispatched When a Purchases Restore fails | StoreKit | |||
| Dispatched when a restore of purchases has completed | StoreKit | |||
| Constant | Defined By | ||
|---|---|---|---|
| VERSION : String = 1.0.0 [static]
Current API Version
| StoreKit | ||
| storeKit | property |
storeKit:StoreKit [read-only] The current instance of the StoreKit singelton. You must call StoreKit.create() before this property is available.
public static function get storeKit():StoreKitError — if StoreKit.create() was not called before first accessing this property.
|
| 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.
ParameterslogCallback:Function (default = null) |
| create | () | method |
public static function create():StoreKitInitializes 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 .
ReturnsStoreKit — initialized instance of StoreKit extension interface.
|
Error — if StoreKit has already been initialized.
|
| dispose | () | method |
public function dispose():voidDispose of Context
| isStoreKitAvailable | () | method |
public function isStoreKitAvailable():BooleanChecks if purchases allowed on this device (ie, parental controls may prevent them.) Call this after StoreKit.create() and before making any other calls.
ReturnsBoolean — true if the running device is capable of making purchases.
|
| isSupported | () | method |
public static function isSupported():BooleanChecks 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.)
ReturnsBoolean — true if StoreKit is supported; false otherwise.
|
| loadProductDetails | () | method |
public function loadProductDetails(productIDs:Vector.<String>):voidCalls 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
| purchaseProduct | () | method |
public function purchaseProduct(productID:String, quantity:int = 1):voidMakes 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) |
Error — if the quantity is invalid.
|
See also
| restoreTransactions | () | method |
public function restoreTransactions():voidRestores 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
| PRODUCT_DETAILS_FAILED | Event |
com.milkmangames.nativeextensions.ios.events.StoreKitErrorEventDispatched When a Product list loading fails
| PRODUCT_DETAILS_LOADED | Event |
com.milkmangames.nativeextensions.ios.events.StoreKitEventDisapatched when the product list has been loaded.
| PURCHASE_CANCELLED | Event |
com.milkmangames.nativeextensions.ios.events.StoreKitEventDispatched when a purchase has been cancelled
| PURCHASE_FAILED | Event |
com.milkmangames.nativeextensions.ios.events.StoreKitErrorEventDispatched when a purchase attempt fails
| PURCHASE_SUCCEEDED | Event |
com.milkmangames.nativeextensions.ios.StoreKitEventDispatched when an item has been successfully purchased, or a purchased item is restored
| TRANSACTION_RESTORE_FAILED | Event |
com.milkmangames.nativeextensions.ios.events.StoreKitErrorEventDispatched When a Purchases Restore fails
| TRANSACTIONS_RESTORED | Event |
com.milkmangames.nativeextensions.ios.events.StoreKitEventDispatched when a restore of purchases has completed
| VERSION | Constant |
public static const VERSION:String = 1.0.0Current API Version