![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
The IAppStoreControl interface.
Enumeration of the App Store connection status. Use GetStatus() to get the current status.
Murl.IAppStoreControl.STATUS_IDLE | The connection is idle. |
Murl.IAppStoreControl.STATUS_CONNECTING | Connecting to the App Store is in progress. |
Murl.IAppStoreControl.STATUS_CONNECTED | The connection to the App Store is established. |
Murl.IAppStoreControl.STATUS_ERROR | Connection error. |
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()
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)
productId | The identifier of the product. |
productType | The type of the product. |
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()
Disconnect from the App Store. The App Store status changes to IAppStoreControl::STATUS_IDLE immediately.
Boolean DisconnectFromStore()
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()
Restore any previously completed purchase transactions. To successfully restore any previous transactions, the current status must be IAppStoreControl::STATUS_CONNECTED.
Boolean RestoreTransactions()
Get the number of available products. The result is only valid after calling ConnectToStore() at least once.
Integer GetNumberOfAvailableProducts()
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)
index | The zero-based index of the product. |
Get a product by identifier. The result is only valid after calling ConnectToStore() at least once.
Murl.IAppStoreProduct GetAvailableProduct(String productId)
productId | The identifier of the product. |
Check if the App Store allows to purchase products at all. The result is only valid after calling ConnectToStore() at least once.
Boolean CanPurchaseProducts()
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)
product | The product to purchase. |
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)
product | The product to consume. |
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)
product | The product to confirm consumption. |
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)
product | The product to cancel. |
Get the description string of the last error. Use ClearLastError() to reset the error status.
String GetLastError()
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()