Murl Engine Lua Addon API  Version 1.0 beta
Murl.IAppStoreControl

The IAppStoreControl interface.


Table members

Inherited


Murl.IControlable

Enumerations


Status

Enumeration of the app-store connection status. Use GetStatus() to get the current status.

Murl.IAppStoreControl.STATUS_IDLEThe connection is idle.
Murl.IAppStoreControl.STATUS_CONNECTINGConnecting to the app-store is in progress.
Murl.IAppStoreControl.STATUS_CONNECTEDThe connection to the app-store is established.
Murl.IAppStoreControl.STATUS_ERRORConnection error.


Functions



Methods


GetStatus()

Get the app-store connection status. The connection operation works asynchronously, the application can check the current status to operate correctly.

Murl.IAppStoreControl.Status GetStatus()

Returns
Murl.IAppStoreControl.Status The app-store connection status.

RegisterProduct(productId, productType)

Register a product to the app-store control. Products can only be registered before calling ConnectToStore() at least once.

Boolean RegisterProduct(String productId, Murl.IAppStoreProduct.ProductType productType)

Parameters
productIdThe identifier of the product.
productTypeThe type of the product.
Returns
Boolean true if successful.

ConnectToStore()

Start connecting to the app-store. When starting the connnection, the app-store status changes to IAppStoreControl::STATUS_CONNECTING immediately. When the app-store is connected the app-store status changes to IAppStoreControl::STATUS_CONNECTED.

Boolean ConnectToStore()

Returns
Boolean always true.

DisconnectFromStore()

Disconnect from the app-store. The app-store status changes to IAppStoreControl::STATUS_IDLE immediately.

Boolean DisconnectFromStore()

Returns
Boolean always true.

RestoreTransactions()

Restore any previously completed purchase transactions. To successfully restore any previous transactions, the current status must be IAppStoreControl::STATUS_CONNECTED.

Boolean RestoreTransactions()

Returns
Boolean true if successful.

GetNumberOfAvailableProducts()

Get the number of available products. The result is only valid after calling ConnectToStore() at least once.

Integer GetNumberOfAvailableProducts()

Returns
Integer The number of available products.

GetAvailableProduct(index)

Get a product by index. The result is only valid after calling ConnectToStore() at least once. A valid product index is [0 .. GetNumberOfAvailableProducts() - 1].

Murl.IAppStoreProduct GetAvailableProduct(Integer index)

Parameters
indexThe zero-based index of the product.
Returns
Murl.IAppStoreProduct The product object or null if index is out of range.

GetAvailableProduct(productId)

Get a product by identifier. The result is only valid after calling ConnectToStore() at least once.

Murl.IAppStoreProduct GetAvailableProduct(String productId)

Parameters
productIdThe identifier of the product.
Returns
Murl.IAppStoreProduct The product object or null if the identifier is not found.

CanPurchaseProducts()

Check if the app-store allows to purchase products at all. The result is only valid after calling ConnectToStore() at least once.

Boolean CanPurchaseProducts()

Returns
Boolean true if in-app purchasing is possible.

PurchaseProduct(product)

Start purchasing of a product. When starting a purchase, the product status changes to IAppStoreProduct::STATUS_PURCHASE_PENDING immediately. The purchase is finished when the product status is IAppStoreProduct::STATUS_PURCHASED.

Boolean PurchaseProduct(Murl.IAppStoreProduct product)

Parameters
productThe product to purchase.
Returns
Boolean true if starting the purchase was successful.

ConsumeProduct(product)

Consume an already purchased and consumeable product. A product can be consumed if the product type is IAppStoreProduct::PRODUCT_TYPE_CONSUMABLE and the product status is IAppStoreProduct::STATUS_PURCHASED. When starting a consume, the product status changes to IAppStoreProduct::STATUS_CONSUME_PENDING immediately.
The consume is finished when the product status is IAppStoreProduct::STATUS_CONSUMED, see ConfirmConsumedProduct() to finalize the consumption.

Boolean ConsumeProduct(Murl.IAppStoreProduct product)

Parameters
productThe product to consume.
Returns
Boolean true if consuming the product was successful.

ConfirmConsumedProduct(product)

Confirm consumption of a consumed product. If a product has the status IAppStoreProduct::STATUS_CONSUMED the consumption of the product must be confirmed. When confirming the consumption, the product status changes to IAppStoreProduct::STATUS_NOT_PURCHASED immediately and the product's receipt data is emptied.

Boolean ConfirmConsumedProduct(Murl.IAppStoreProduct product)

Parameters
productThe product to confirm consumption.
Returns
Boolean true if confirm consumption of the product was successful.

GetLastError()

Get the description string of the last error. Use ClearLastError() to reset the error status.

String GetLastError()

Returns
String The description string of the last error.

ClearLastError()

Clear the last error status and string. Set the connection status IAppStoreProduct::STATUS_ERROR to IAppStoreProduct::STATUS_CONNECTED or IAppStoreProduct::STATUS_IDLE.
Clear the last error string.

Boolean ClearLastError()

Returns
Boolean true if successful.