InAppProductsModule Class
Item Index
Methods
Properties
Constants
- ITEM_TYPE_ONE_TIME
- ITEM_TYPE_SUBSCRIPTION
- PURCHASE_STATE_CANCELED
- PURCHASE_STATE_PURCHASED
- PURCHASE_STATE_REFUNDED
- RESULT_BILLING_UNAVAILABLE
- RESULT_DEVELOPER_ERROR
- RESULT_ERROR
- RESULT_EXCEPTION
- RESULT_ITEM_ALREADY_OWNED
- RESULT_ITEM_NOT_OWNED
- RESULT_ITEM_UNAVAILABLE
- RESULT_OK
- RESULT_SERVICE_UNAVAILABLE
- RESULT_USER_CANCELED
- STATE_NOT_READY
- STATE_NOT_SUPPORTED
- STATE_READY
- SUPPORT_STATUS_ALL
- SUPPORT_STATUS_ERROR
- SUPPORT_STATUS_NONE
- SUPPORT_STATUS_ONE_TIME
- SUPPORT_STATUS_SUBSCRIPTION
Methods
getProducts
-
params
Provides details of a list of products referenced by SKUs. A maximum of 20 SKUs can be submitted at a time.
The result of this operation is reported via the receivedProducts event.
Parameters:
-
params
ObjectAn object with the following properties:
-
SKUs
Array of Strings
-
Returns:
true
if the product request was started
successfully.
getPurchases
()
Boolean
Returns the products currently owned (purchased but not consumed) by the user.
The result of this operation is reported via the receivedPurchases event.
Returns:
true
if the request was started
successfully.
getSupportStatus
()
Number
Determines whether billing is supported. Note that the return value is a number, not a simple boolean. On Android, billing may be supported independently for one-time and subscription type items. For sake of simplicity, this function checks both and returns a single number that indicates the level of support. Use the SUPPORT_STATUS_NONE, SUPPORT_STATUS_ONE_TIME, SUPPORT_STATUS_SUBSCRIPTION, SUPPORT_STATUS_ALL, and SUPPORT_STATUS_ERROR constants to interpret the returned value.
Returns:
See the SUPPORT_STATUS_* constants for possible values.
Properties
autoCompletePurchases
Boolean
read-only
On iOS, this property defines whether the module will automatically mark
the purchases completed. On Android, this is a read-only property
whose value is always true
-- it is only present to
enhance parity between the two platforms. We chose true
as the constant value of this property because on Android there is
no need/ability to separately complete purchases; they are essentially
always auto-completed.
state
Number
read-only
The state of the module. Possible values are STATE_NOT_READY and STATE_READY.
On Android, the module is not immediately ready when it's loaded
because it needs to start the billing service, and it may go back
to a "not ready" state later if the service is stopped. The app must
wait for a
stateChange event with the state
set to
STATE_READY before it can use the services of the module.
Constants
ITEM_TYPE_ONE_TIME
String
One of the possible product types, to be used in a call to the InAppProductsModule/purchase:method method.
ITEM_TYPE_SUBSCRIPTION
String
One of the possible product types, to be used in a call to the InAppProductsModule/purchase:method method.
PURCHASE_STATE_CANCELED
Number
One of the possible values of the state
property of
Purchase objects.
PURCHASE_STATE_PURCHASED
Number
One of the possible values of the state
property of
Purchase objects.
PURCHASE_STATE_REFUNDED
Number
One of the possible values of the state
property of
Purchase objects.
RESULT_BILLING_UNAVAILABLE
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_DEVELOPER_ERROR
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_ERROR
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_EXCEPTION
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_ITEM_ALREADY_OWNED
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_ITEM_NOT_OWNED
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_ITEM_UNAVAILABLE
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_OK
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_SERVICE_UNAVAILABLE
Number
One of the possible values of the result field in various events and callback parameters.
RESULT_USER_CANCELED
Number
One of the possible values of the result field in various events and callback parameters.
STATE_NOT_READY
Number
One of the possible values of the state property.
This value means that module not ready to be used.
STATE_NOT_SUPPORTED
Number
One of the possible values of the state property.
This value means that the app is running in the simulator. This module provides functionality that will not work in the simulator. Please run your tests on an actual device.
STATE_READY
Number
One of the possible values of the state property.
This value means that module is ready to be used.
SUPPORT_STATUS_ALL
Number
One of the possible values returned by the getSupportStatus method.
This value means that all the product types are supported.
SUPPORT_STATUS_ERROR
Number
One of the possible values returned by the getSupportStatus method.
This value means that an error occurred while querying the support status.
SUPPORT_STATUS_NONE
Number
One of the possible values returned by the getSupportStatus method.
This value means that none of the product types are supported.
SUPPORT_STATUS_ONE_TIME
Number
One of the possible values returned by the getSupportStatus method.
This value means that one-time product types are supported.
SUPPORT_STATUS_SUBSCRIPTION
Number
One of the possible values returned by the getSupportStatus method.
This value means that subscription product types are supported.
Events
purchaseConsumed
This event returns the result of a consume call.
purchaseUpdate
This event is fired when the state of a purchase changes. This can happen after a call to the getPurchases or purchase function.
Event Payload:
-
purchase
Purchase -
errorCode
NumberThe error code; only present if an error occurred.
-
errorMessage
StringThe error message; only present if an exception occurred.
receivedProducts
This event returns the result of a getProducts call.
Event Payload:
-
products
Array of ProductsAn array of Product objects.
-
invalid
Array of StringsAn array of strings holding those product identifiers that were passed on to the getProducts function but are not valid.
-
errorCode
NumberThe error code; only present if an error occurred.
-
errorMessage
StringThe error message; only present if an exception (that is, a specific type of error) occurred.
receivedPurchases
This event returns the result of a successful getPurchases call.
Event Payload:
-
purchases
Array of PurchasesAn array Purchase objects.
-
errorCode
NumberThe error code; only present if an error occurred.
-
errorMessage
StringThe error message; only present if an exception occurred.
stateChange
Notifies the app about a change in the state of the module. See the state property for more information.
Event Payload:
-
state
Number -
errorCode
Number -
errorMessage
String