DISTRIBUTION OF TIZEN-BASED WATCH APPS HAS BEEN DISCONTINUED
Web IAP for Galaxy Watch
Samsung In-App Purchase (IAP) for Galaxy Watch is a Galaxy Store service that allows third-party watch applications to sell in-app items.
IAP for Galaxy Watch only works if your Galaxy Watch is paired with your phone.
The IAP Client for watch communicates with the IAP Client for phone which internally manages communication with supporting IAP services and the Samsung ecosystem (such as Samsung Account, Samsung Checkout, and Samsung Rewards). In other words, it acts as an intermediary between watch app and Samsung IAP system of the phone.
You can concentrate on integrating IAP API calls and IAP Server API calls into your watch app.
To integrate IAP for Galaxy Watch :
Using Tizen Extension SDK, IAP Web APIs enable you to easily integrate IAP functionality into your watch app, such as configuring IAP, getting item details, offering and selling items, and managing purchased items.
Using Galaxy Watch Studio (formerly Galaxy Watch Designer), you can make your own watch face that prompts for payment after a free trial period, without the complexity of coding.
For more details, see the Galaxy Watch Studio online tutorial.
By integrating IAP features, your watch apps can sell these types of in-app items:
Item type
Description
Consumable
App users can use items only one time (for example, coins, special powers, or gems).
Non-consumable
App users can use items any number of times (for example, e-books or game boards). Items cannot be repurchased.
Note :
During IAP integration testing, if your application sets to TEST mode, the purchase record is initialized every 60 minutes to allow repurchase.
Auto-recurring Subscription
These items are purchased automatically at specific intervals. App users can access items (such as magazines, e-zines, or newspapers) any number of times during a free trial or while their paid subscriptions are active. App users can cancel at any time after purchase during subscription period. App users can repurchase items after cancellation.
Note :
During IAP integration testing, if your application is set to TEST mode, the subscription cycle is automatically renewed every 10 minutes and the subscription is automatically canceled after 12 renewals.
Integrate IAP into your watch app
This section explains how to prepare your app to sell in-app items using Tizen Extension SDK. You can use Galaxy Watch Studio to make a watch face that prompts for payment after a free trial period, without the complexity of coding.
To prepare for integrating IAP features and testing the integration, do the following.
1. Create a project
Create a project in Tizen Studio.
The required_version must be at least 2.3.2 in the config.xml file:
IAP supports three operational modes. One is for enabling billing for item purchases and the other two are for testing IAP functions without billing app users for item purchases.
Mode
Description
IAP_COMMERCIAL_MODE
Financial transactions do occur for successful requests, and actual results are returned (successful or failed). The app gets in-app item information of the app whose status in Seller Portal is For sale.
IAP_SUCCESS_TEST_MODE
Financial transactions do not occur (app users are not billed for item purchases), and successful results are always returned. The app gets in-app item information of the app whose status in Seller Portal is Registering or Updating.
IAP_FAILURE_TEST_MODE
All IAP requests fail. Negative testing to ensure that your app can handle errors such as improper input and user actions.
Note :
The Tizen emulator only supports these two modes: IAP_SUCCESS_TEST_MODE IAP_FAILURE_TEST_MODE
If you set the mode to IAP_COMMERCIAL_MODE, it is automatically changed to IAP_SUCCESS_TEST_MODE.
Get in-app items available for purchase
To get all registered in-app items from Galaxy Store, use the getItemList() method.
Pass in the index of the first and last item, the item type, service mode, callback function, and user data as parameters.
When the reply is delivered, the GetItemSuccessCallback or ErrorCallback callback is invoked with the JsonObject that stores the query results.
Subscription duration unit, defined as an upper case string: MONTH
mSubscriptionDurationMultiplier
String
If the item type (mType) is 02 or 03, this is the item duration. Combined with mSubscriptionDurationUnit, it expresses the subscription duration, for example, 1MONTH.
Code snippet
Request the available items, and retrieve the item details in the reply callback:
To get all purchased items from Galaxy Stroe, use the getPurchasedItemList() or getPurchasedItemListByIds() method:
For getPurchasedItemList(), pass in the index of the first and last item, the item type, the start and end date, the callback function, and user data as parameters.
For getPurchasedItemListByIds(), pass in the item IDs separated by comma (,), the callback function, and user data as parameters.
When the reply is delivered, the GetItemSuccessCallback or ErrorCallback callback is invoked with the JsonObject that stores the query results.
Date of purchase For example: "2013-11-15 10:31:23"
mSubscriptionEndDate
String
If the item type (mType) is 02 or 03, this is the due date
mJsonString
String
Original JSON string
Code snippet
webapis.inapppurchase.getPurchasedItemList(1, 10, new tizen.TZDate(2020, 01, 01), new tizen.TZDate(2022, 12,31), successCallback, errorCallback);
// item IDs can be obtained by seperating the values returned by the getItemList() with comma(,).
webapis.inapppurchase.getPurchasedItemListByIds("item1,item2,item3", successCallback, errorCallback);
/* Success callback */
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].mItemPrice);
}
}
}
/* Error callback */
function errorCallback(error)
{
/* Error handling */
}
Handling errors
During the IAP process, various errors can occur, for example, due to an unstable network, connection error, invalid account, or invalid product.
If an error occurs, your application receives the WebAPIError error type in the ErrorCallback callback. Handle all errors appropriately.
Error Code
Error Name
Description
PaymentIsCanceledError
Payment canceled
NetworkError
Network is not available
IOError
IOException
TimeoutError
Timeout exception
InitializationError
Failure during IAP initialization
NeedAppUpgradeError
Samsung IAP upgrade is required
AlreadyPurchasedError
Error when a non-consumable product is repurchased or a subscription product is repurchased before the product expiration date
WhileRunningError
Error when payment is requested without bundle information
ProductDoesNotExistError
Error when the requested item list is not available
ConfirmInBoxError
The payment result is not received after requesting payment from the server, and the purchased item list is not confirmed
NotExistLocalPriceError
The item is not for sale in the country
NotAvailableShopError
IAP is not supported in the country
InvalidValuesError
Invalid parameter
NotSupportedError
The device does not support IAP
SecurityError
This functionality is not allowed
UnknownError
Any other error case
Verify a purchase
This server API enables your server and client app to verify that a specified in-app item purchase and payment transaction were successfully completed.
The API returns a JSON object with a successful status and details about a successful transaction and the item or with a failure status.
This API can help to prevent malicious purchases and ensure that purchase and payment transactions were successful when the client app experiences network interruptions after an item purchase and payment transaction.
Besides verifying a purchase, Samsung IAP Server API also obtains service token information and gets detailed information of Auto Recurring Subscription (ARS) item purchase.
Submit the app to Galaxy Store
1. Check the operation mode
After IAP integration, you must check the operation mode before submitting the app.
If you submit the app with IAP_SUCCESS_TEST_MODE, the users will get all the items for free.
So, before beta release or normal publication, confirm if the operation mode is IAP_COMMERCIAL_MODE.
2. Submit the app
When you have created an app version that is ready for review testing and normal publication, register the app and its in-app item, and then click Submit.
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.