Table of Contents

GoogleBilling

Supported platforms:

Available since version: Gideros 2012.09

Description:

The GoogleBilling class is defined in the module "googlebilling". Therefore, you need to call
require("googlebilling") before using it. Loading the Google Billing module
also creates a global variable googlebilling of type GoogleBilling for direct use.

GoogleBilling Events and Response Codes


GoogleBilling class dispatches 5 events: Event.CHECK_BILLING_SUPPORTED_COMPLETE,
Event.REQUEST_PURCHASE_COMPLETE,Event.RESTORE_TRANSACTIONS_COMPLETE,
Event.CONFIRM_NOTIFICATION_COMPLETE and Event.PURCHASE_STATE_CHANGE.
Event.*_COMPLETE events contains a field event.responseCode which provides status information
and error information about a request. Response code can be one of these values:

  • GoogleBilling.OK: Indicates that the request was sent to the server successfully. When this code is returned


in response to a checkBillingSupported function, indicates that billing is supported.

you specified is not recognized by the Google Play application or the user is ineligible for in-app billing
(for example, the user resides in a country that prohibits in-app purchases).

This can happen if the product ID is misspelled in your requestPurchase function or if an item is unpublished in the application's product list.

  • GoogleBilling.DEVELOPER_ERROR: Indicates that an application is trying to make an in-app billing request but the application has not declared the


com.android.vending.BILLING permission in its manifest. Can also indicate that an application is not properly signed,
or that you sent a malformed request, such as a request with missing Bundle keys or a request that uses an unrecognized request type.

  • GoogleBilling.ERROR: Indicates an unexpected server error. For example, this error is triggered if you try to purchase an item from yourself, which is not allowed by Google Wallet.


# Event.CHECK_BILLING_SUPPORTED_COMPLETE


Dispatched when checkBillingSuported function completes. It contains event.responseCode and event.productType fields.

# Event.REQUEST_PURCHASE_COMPLETE


Dispatched when requestPurchase function completes. It contains event.responseCode, event.productId, event.productType and event.developerPayload fields.

# Event.RESTORE_TRANSACTIONS_COMPLETE


Dispatched when restoreTransactions function completes. It contains event.responseCode fields.

# Event.CONFIRM_NOTIFICATION_COMPLETE


Dispatched when confirmNotification function completes. It contains event.responseCode and event.notificationId fields.

# Event.PURCHASE_STATE_CHANGE


Dispatched when information about a transaction is received. It contains event.purchaseState, event.productId, event.notificationId, event.purchaseTime and event.developerPayload fields.

Methods, events and properties: