Moai SDK  2.0
MOAIBillingAndroid Class Reference
+ Inheritance diagram for MOAIBillingAndroid:

Function List

checkBillingSupported
 
confirmNotification
 
getUserId
 
requestPurchase
 
restoreTransactions
 
setBillingProvider
 
setPublicKey
 
checkInAppSupported
 
checkSubscriptionSupported
 
consumePurchaseSync
 
getPurchasedProducts
 
purchaseProduct
 
purchaseProductFortumo
 
requestProductsSync
 

Detailed Description

ConstantsDescription
MOAIBillingAndroid.CHECK_BILLING_SUPPORTED Event code for billing support request completion.
MOAIBillingAndroid.PURCHASE_RESPONSE_RECEIVED Event code for item purchase request receipt.
MOAIBillingAndroid.PURCHASE_STATE_CHANGED Event code for item purchase state change (purchased, refunded, etc.).
MOAIBillingAndroid.RESTORE_RESPONSE_RECEIVED Event code for restore purchases request receipt.
MOAIBillingAndroid.USER_ID_DETERMINED Event code for user ID request completion.
MOAIBillingAndroid.BILLING_PROVIDER_GOOGLE Provider code for Google Play.
MOAIBillingAndroid.BILLING_PROVIDER_AMAZON Provider code for Amazon.
MOAIBillingAndroid.BILLING_RESULT_SUCCESS Error code for a successful billing request.
MOAIBillingAndroid.BILLING_RESULT_USER_CANCELED Error code for a billing request canceled by the user, if detected.
MOAIBillingAndroid.BILLING_RESULT_BILLING_UNAVAILABLE Error code for a billing request attempted with no billing provider present.
MOAIBillingAndroid.BILLING_RESULT_ITEM_UNAVAILABLE Error code for a billing request for an unavailable item.
MOAIBillingAndroid.BILLING_RESULT_ERROR Error code for a billing request error.
MOAIBillingAndroid.BILLING_PURCHASE_STATE_ITEM_PURCHASED Purchase state code for a successfully purchased item.
MOAIBillingAndroid.BILLING_PURCHASE_STATE_PURCHASE_CANCELED Purchase state code for a canceled purchase.
MOAIBillingAndroid.BILLING_PURCHASE_STATE_ITEM_REFUNDED Purchase state code for a refunded/revoked purchase.

Function Documentation

checkBillingSupported

Check to see if the currently selected billing provider is available.


function checkBillingSupported ()

Returns
boolean success
checkInAppSupported

Check to see if the device can get in app billing.


function checkInAppSupported ()

Returns
boolean success
checkSubscriptionSupported

Check to see if the device can get subscription billing.


function checkSubscriptionSupported ()

Returns
boolean success
confirmNotification

Confirm a previously received notification. Only applies to the Google Play billing provider.


function confirmNotification ( string notification )

Parameters
stringnotification The notification ID to confirm.
Returns
boolean success
consumePurchaseSync

Consumes a purchase.


function consumePurchaseSync ( string token )

Parameters
stringtoken
Returns
nil
getPurchasedProducts

Gets the user's purchased products.


function getPurchasedProducts ( number type [, string continuation ] )

Parameters
numbertype
stringcontinuation Optional.
Returns
string products
getUserId

Get the ID of the current user for the currently selected billing provider. Only applies to the Amazon billing provider.


function getUserId ()

Returns
boolean success
purchaseProduct

Starts a purchase intent for the desired product.


function purchaseProduct ( string sku, number type [, string devPayload ] )

Parameters
stringsku
numbertype
stringdevPayload Optional.
Returns
nil
purchaseProductFortumo

Starts a purchase intent for the desired product.


function purchaseProductFortumo ( string sku, int type [, string devPayload ] )

Parameters
stringsku
inttype
stringdevPayload Optional.
Returns
nil
requestProductsSync

Gets the products from Google Play for the current app.


function requestProductsSync ( table skus, number type )

Parameters
tableskus
numbertype
Returns
string products
requestPurchase

Request the purchase of an item.


function requestPurchase ( string sku [, string payload ] )

Parameters
stringsku The SKU to purchase.
stringpayload Optional. The request payload to be returned upon request completion. Default is nil.
Returns
boolean success
restoreTransactions

Request the restoration of any previously purchased items.


function restoreTransactions ( [ string offset ] )

Parameters
stringoffset Optional. The offset in the paginated results to start from. Only applies to the Amazon billing provider. Default is nil.
Returns
boolean success
setBillingProvider

Set the billing provider to use for in-app purchases.


function setBillingProvider ( number provider )

Parameters
numberprovider The billing provider.
Returns
boolean success
setPublicKey

Set the public key to be used for receipt verification. Only applies to the Google Play billing provider.


function setPublicKey ( string key )

Parameters
stringkey The public key.
Returns
nil