This API provides an interface and methods through features such as:
Since: 2.3.2
Interface | Method |
---|---|
InAppPurchaseObject | |
InAppPurchaseManager | void startPayment (DOMString itemId, IAPMode mode, PaymentSuccessCallback successCallback, optional ErrorCallback? errorCallback) void getItemList (long startNumber, long endNumber, ItemType type, IAPMode mode, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) void getPurchasedItemList (long startNumber, long endNumber, TZDate startDate, TZDate endDate, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) void getPurchasedItemListByIds (DOMString[] itemIds, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) |
PaymentSuccessCallback | void onsuccess (JsonObject item) |
GetItemSuccessCallback | void onsuccess (JsonObject result) |
typedef object JsonObject;
Since: 2.3.2
enum IAPMode {"IAP_COMMERCIAL_MODE", "IAP_SUCCESS_TEST_MODE", "IAP_FAILURE_TEST_MODE"};
Since: 2.3.2
The following values are supported in this release:
Remark : Be sure to set IAP_COMMERCIAL_MODE when uploading an application for distribution so that actual payments from customers can be completed
enum ItemType {"CONSUMABLE", "NON_CONSUMABLE", "SUBSCRIPTION", "AUTO_RECURRING_SUBSCRIPTION", "ALL"};
Since: 2.3.2
The following values are supported in this release:
Remark : Non-consumable product cannot be tested for repurchase. However, repeated testing is available in test mode, not in the production mode, to repurchase every 10 minutes by initializing the mode.
[NoInterfaceObject] interface InAppPurchaseObject { readonly attribute InAppPurchaseManager inapppurchase; };
WebAPIs implements InAppPurchaseObject;
Since: 2.3.2
There will be a webapis.inapppurchase object that allows accessing the functionality of the In-App Purchase API.
[NoInterfaceObject] interface InAppPurchaseManager { void startPayment(DOMString itemId, IAPMode mode, PaymentSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); void getItemList(long startNumber, long endNumber, ItemType type, IAPMode mode, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); void getPurchasedItemList(long startNumber, long endNumber, TZDate startDate, TZDate endDate, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); void getPurchasedItemListByIds(DOMString[] itemIds, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); };
startPayment
void startPayment(DOMString itemId, IAPMode mode, PaymentSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.3.2
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/billing
Parameters:
Exceptions:
with error type InitializationError, if initialization is failed.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if in any other error case.
Code example:
function successCallback(item) { console.log("Item ID : " + item.mItemId); console.log("Item Name : " + item.mItemName); console.log("Price : " + item.mItemPriceString); console.log("Item Image URL : " + item.mItemImageUrl); } function errorCallback(e) { console.log(e.name + " : " + e.message); } webapis.inapppurchase.startPayment("shotgun", "IAP_COMMERCIAL_MODE", successCallback, errorCallback);
getItemList
void getItemList(long startNumber, long endNumber, ItemType type, IAPMode mode, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.3.2
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/billing
Parameters:
Exceptions:
with error type InitializationError, if initialization is failed.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if in any other error case.
Code example:
function successCallback(result) { for(var i = 0; i < result._items.length; i++) { console.log("Item ID : " + result._items[i].mItemId); console.log("Item Name : " + result._items[i].mItemName); console.log("Item Price : " + result._items[i].mItemPriceString); console.log("Item Image URL : " + result._items[i].mItemImageUrl); } } function errorCallback(e) { console.log(e.name + " : " + e.message); } webapis.inapppurchase.getItemList(1, 15, "CONSUMABLE", "IAP_COMMERCIAL_MODE", successCallback, errorCallback);
getPurchasedItemList
void getPurchasedItemList(long startNumber, long endNumber, TZDate startDate, TZDate endDate, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.3.2
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/billing
Parameters:
Exceptions:
with error type InitializationError, if initialization is failed.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if in any other error case.
Code example:
function successCallback(result) { for(var i = 0; i < result._items.length; i++) { console.log("Item ID : " + result._items[i].mItemId); console.log("Item Name : " + result._items[i].mItemName); console.log("Item Price : " + result._items[i].mItemPriceString); console.log("Item Image URL : " + result._items[i].mItemImageUrl); } } function errorCallback(e) { console.log(e.name + " : " + e.message); } webapis.inapppurchase.getPurchasedItemList(1, 15, new tizen.TZDate(2016, 05, 30), new tizen.TZDate(2016, 06, 01), successCallback, errorCallback);
getPurchasedItemListByIds
void getPurchasedItemListByIds(DOMString[] itemIds, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.3.2
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/billing
Parameters:
Exceptions:
with error type InitializationError, if initialization is failed.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if this functionality is not allowed.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if in any other error case.
Code example:
var itemIds = []; function successCallback(result) { if (result._items.length == 0) { console.log("No item"); } else { for(var i = 0; i < result._items.length; i++) { console.log("Item ID : " + result._items[i].mItemId); console.log("Item Name : " + result._items[i].mItemName); console.log("Item Price : " + result._items[i].mItemPriceString); console.log("Item Image URL : " + result._items[i].mItemImageUrl); } } } function errorCallback(e) { console.log(e.name + " : " + e.message); } function getItemListSuccess(result) { if (result._items.length == 0) { console.log("No item"); } else { for (var i = 0; i < result._items.length; i++) { itemIds[i] = result._items[i].mItemId; } webapis.inapppurchase.getPurchasedItemListByIds(itemIds, successCallback, errorCallback); } } webapis.inapppurchase.getItemList(1, 15, "ALL", "IAP_COMMERCIAL_MODE", getItemListSuccess, errorCallback);
[Callback=FunctionOnly, NoInterfaceObject] interface PaymentSuccessCallback { void onsuccess(JsonObject item); };
Since: 2.3.2
onsuccess
void onsuccess(JsonObject item);
Since: 2.3.2
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface GetItemSuccessCallback { void onsuccess(JsonObject result); };
Since: 2.3.2
onsuccess
void onsuccess(JsonObject result);
Since: 2.3.2
Parameters:
module IAP { [NoInterfaceObject] interface InAppPurchaseObject { readonly attribute InAppPurchaseManager inapppurchase; }; WebAPIs implements InAppPurchaseObject; typedef object JsonObject; enum IAPMode {"IAP_COMMERCIAL_MODE", "IAP_SUCCESS_TEST_MODE", "IAP_FAILURE_TEST_MODE"}; enum ItemType {"CONSUMABLE", "NON_CONSUMABLE", "SUBSCRIPTION", "AUTO_RECURRING_SUBSCRIPTION", "ALL"}; [NoInterfaceObject] interface InAppPurchaseManager { void startPayment(DOMString itemId, IAPMode mode, PaymentSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); void getItemList(long startNumber, long endNumber, ItemType type, IAPMode mode, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); void getPurchasedItemList(long startNumber, long endNumber, TZDate startDate, TZDate endDate, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); void getPurchasedItemListByIds(DOMString[] itemIds, GetItemSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises (WebAPIException); }; [Callback=FunctionOnly, NoInterfaceObject] interface PaymentSuccessCallback { void onsuccess(JsonObject item); }; [Callback=FunctionOnly, NoInterfaceObject] interface GetItemSuccessCallback { void onsuccess(JsonObject result); }; };