Skip to content

module InAppBilling.API

Mohammad Naghavi edited this page Jun 17, 2014 · 25 revisions

Class: module:InAppBilling

module:InAppBilling

new module:InAppBilling()

Source:

Members

ERROR_CODES_BASE

Error codes base.

all the codes bellow should be kept synchronized between: InAppPurchase.m InAppBillingPlugin.java android_iab.js ios_iab.js

Be carefull assiging new codes, these are meant to express the REASON of the error as exact as possible!

Source:

Methods

buy(success, fail, productId)

Buys an item. The product should be loaded before this call. You can either load items at init or by calling getProductDetails.

Parameters:
Name Type Description
success buySuccessCallback

the callback for successful purchse

fail errorCallback

the callback for failed purchase

productId string

the product's ID to be bought

Source:

consumePurchase(success, fail, productId)

Consume an item. The product should be of consumable type.

Parameters:
Name Type Description
success consumePurchaseSuccessCallback

callback for successful consumption

fail type

callback for failed consumption

productId type

id of the already bought product (not the purchase itself)

Source:

getAvailableProducts(success, fail)

Get all the loaded products. Products should be loaded before this call. You can either load items at init or by calling getProductDetails.

Parameters:
Name Type Description
success getAvailableProductsSuccessCallback

callback for successful query

fail errorCallback

callback for failed query

Source:

getProductDetails(success, fail, productIds)

Get details for a list of product ids. This will also load the products' details if they are not already loaded.

Parameters:
Name Type Description
success getProductDetailsSuccessCallback

callback for successful query

fail errorCallback

callback for failed query

productIds String | Array.<String>
Source:

getPurchases(success, fail)

This will return the already boutgh items. The consumed items will not be on this list, nor can be retrieved with any other method.

Parameters:
Name Type Description
success getPurchasesSuccessCallback
fail errorCallback
Source:

init(success, fail, options, productIds)

This initiates the plugin, you can optionally pass in one or multiple product IDs for their details to be loaded during initialization.

Parameters:
Name Type Description
success initSuccessCallback

the success callback

fail errorCallback

the failure callback

options Object

options for configuring the plugin

Properties
Name Type Argument Description
showLog Boolean <optional>

[true] wether to show logs or not, this is strongly recommended to be set to false for production

productIds Object

an optional list of product IDs to load after initialization was successful

Source:

log(msg)

This function accepts and outputs all the logs, both from native and from JS this is intended to make the debuging easier, you only need to have access to JS console output.

Parameters:
Name Type Description
msg String
Source:

subscribe(success, fail, productId)

Subscribes to an item. The product should be loaded before this call. You can either load items at init or by calling getProductDetails.

Parameters:
Name Type Description
success buySuccessCallback

callback for successful subscription

fail errorCallback

callback for failed subscription

productId String

id of the subscription item

Source:

Generated with wicked.
  • Installation
  • [Stores setup](Stores setup)
  • [Purchase verification](Purchase verification)
  • [Testing plugin](Automatic tests)
  • [API documentation](API documentation)
  • Debugging

Philosophy

  • Roadmap
  • [Compatibility issues](Compatibility issues)

API

Clone this wiki locally