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. This method also resets the internal status of all registered products to either STATUS_PURCHASED or STATUS_NOT_PURCHASED.

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.

ReconnectToStore()

Reconnect to the App Store. This method is basically identical to calling DisconnectFromStore() followed by a call to ConnectToStore(), except that the internal status of the registered products is not touched. Can be used in a logic implementation when e.g. the app run state changes to APP_RUN_STATE_RUNNING, to refresh the store connection.

Boolean ReconnectToStore()

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.

SwitchAppStoreImplementation(id)

Switch to a different variant of the app store controller implementation. Can be used to switch between different implementations for quality testing. Currenty only implemented for the Google Play Store: Use parameter id 1 for the Google Play Billing Library version 3 (new version) Use parameter id 0 for the InAppBillingService version 3 (old version)

Boolean SwitchAppStoreImplementation(Integer id)

Parameters
idThe identifier of the implementation.
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.

TryCancelProduct(product)

Try to cancel an already purchased product. This method can be used in a test (sandbox) environment to try to cancel a previously purchased product. Note: Currently this only works for the Google Play store when using a test account; on all other platforms this method simply returns false.

Boolean TryCancelProduct(Murl.IAppStoreProduct product)

Parameters
productThe product to cancel.
Returns
Boolean true if cancelling 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.