Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Recommendations
Filter
tutorials
blogsamsung in-app purchase (iap) offers developers a robust solution for handling digital transactions within mobile applications available on galaxy store. whether it is selling digital goods, handling subscriptions, or managing refunds, samsung iap is designed to offer a smooth, secure experience. the samsung iap orders api expands the scope of these benefits. you can fetch all the payments and refunds history according to specified dates on your server to easily manage your application. this content guides you through the essential components for implementing both the samsung iap and samsung iap orders apis. figure 1: sample application ui in this tutorial, we provide a sample android application called book spot, which offers users the option to subscribe to their favorite books and consumable items, such as text fonts, for purchase. this user application is provided to help you to integrate samsung iap sdk with your applicaiton. finally, we also provide a sample server application to view all the payment and refund history on specific dates by calling the samsung iap orders api from the back-end server. prerequisites before implementing the samsung iap order api on your server, you need to perform iap functionalities to retrieve purchase history. you need to integrate samsung iap with your application. if you don't have an app yet, follow these steps to ensure a smooth and effective process. step 1: implement samsung iap in your app to integrate the iap system into your application, follow this general flow. integrate the samsung iap sdk into your application. initiate item purchase by calling startpayment() with the necessary parameters, such as the item id and a listener to handle the results. after the transaction, verify whether the purchase is successful with iap/v6/receipt. this involves checking if the purchase id is valid. follow the ensuring secure purchases using the samsung iap server api for more details. once the purchase is confirmed, allow the item to be consumed using consumepurchaseitems(). this step ensures that the item can be repurchased if needed. for more information about the iap sdk integration, you can follow the integration of samsung iap services in android apps article. also get help from the sample android application. step 2: upload your application upload the application for beta testing on galaxy store. a step-by-step guide with screenshots has been provided in the documentation. for more details, see the section “production closed beta test” in the test guide. step 3: purchase items finally, create products in seller portal so that users can purchase or subscribe to them while using the application. for more details about the available items that seller portal supports, see the programming guide. implementation of the samsung iap orders api the samsung iap orders api is used to view all payments and refunds on a specific date. it does this by fetching the payments and refunds history within the date you specified. let’s implement the samsung iap orders api and create a server to listen to its response. through server-to-server communication, the api returns all order data for the application. overview of the orders api to view all payments and refunds: you must make a post request to the samsung iap orders api endpoint with the required headers specified below. if you specify a date, all the payment history within this date is returned. otherwise, it only returns all the data from the day before the current date. api endpoint: https://devapi.samsungapps.com/iap/seller/orders method: post headers: add the following fields to the request header. for more information, see the create an access token page, which will help you understand how to create the access token in detail. the token is used for authorization. you can also get the service account id by clicking the assistance > api service tabs on seller portal. for more details, read the section create a service account and visit seller portal. header name description required/optional values content-type format of the request body required application/json authorization authorization security header required bearer: access_token service account id this id can be created in seller portal and is used to generate the json web token (jwt) required service-account-id parameters: the following parameters can be used to build your post request. name type required/optional description sellerseq string required your seller deeplink, which is found in your profile in seller portal and consists of a 12-digit number. packagename string optional used to view payment and refund data. you can provide the application package name. when a package name is not specified, the data for all applications is shown. requestdate string optional specify a date from which to view the payment and refund data. if the date is not specified, the data from a day before your current date is returned. continuationtoken string optional use this if you want to check if there is a continuation for the data on the next page. if there is no more data, the response is null. configuring the server you can develop a spring boot server for this purpose. here are the guidelines on how to set up this server. set up a spring boot project. for more information, follow the steps in developing your first spring boot application. set up your server endpoint. create a controller for the samsung iap orders api in an integrated development environment (ide) after importing the spring boot project you created. this helps managing all in-app order-related activities and processing them within your application. the controller receives post requests sent from samsung’s iap orders service ensuring the communication with your application. to ensure smooth communication with the samsung iap orders api, it's essential to structure your server requests effectively. below is a clear and concise breakdown of the process. 1. setup dependencies to implement rest api support, add the following okhttp library dependencies to your application's build.gradle file. implementation 'com.squareup.okhttp3:okhttp: version' implementation 'com.google.code.gson:gson: version' 2. define parameters encapsulate request parameters for cleaner handling. public class orderrequest { private final string sellerseq; public orderrequest(string sellerseq) { this.sellerseq = sellerseq; } public string tojson() { return string.format("{\"sellerseq\":\"%s\"}", sellerseq); } } 3. build the http request centralize request configuration for maintainability. public class orderservice { private static final string api_url = "https://devapi.samsungapps.com/iap/seller/orders"; private static final string token = "0djt9yzryukdogbvulxxxxxx"; private static final string service_account_id = "85412253-21b2-4d84-8ff5-xxxxxxxxxxxx"; private final okhttpclient client = new okhttpclient(); public void sendorderrequest(string sellerseq) { orderrequest orderrequest = new orderrequest(sellerseq); requestbody body = requestbody.create(orderrequest.tojson(), mediatype.parse("application/json; charset=utf-8")); request request = new request.builder() .url(api_url) .post(body) .addheader("authorization", "bearer " + token) .addheader("service-account-id", service_account_id) .addheader("content-type", "application/json") .build(); executerequest(request); } } 4. handle response ensure robust error handling for api calls. private void executerequest(request request) { client.newcall(request).enqueue(new callback() { @override public void onfailure(@notnull call call, @notnull ioexception e) { system.err.println("request failed: " + e.getmessage()); } @override public void onresponse(@notnull call call, @notnull response response) throws ioexception { try (responsebody responsebody = response.body()) { if (!response.issuccessful()) { system.err.printf("unexpected response [%d]: %s%n", response.code(), responsebody.string()); return; } system.out.println("response: " + responsebody.string()); } } }); } congratulations! you have just built the spring boot server to handle api post requests using the okhttpclient to manage http requests and responses for your sample application. example api response as previously mentioned, a json-formatted response is returned to your request. for detailed descriptions of each response body element, see the “response” section of the samsung iap orders api documentation. the following output format is a sample in which only some of the response-body data is presented. the continuationtoken parameter key returns null because there is no continuation for the data on the next page. the orderitemlist parameter key lists all the orders with specific details, such as orderid, countryid, packagename, among others. { "continuationtoken": null, "orderitemlist": [ { "orderid": "s20230210kr019xxxxx", "purchaseid": "a778b928b32ed0871958e8bcfb757e54f0bc894fa8df7dd8dbb553cxxxxxxxx", "contentid": "000005059xxx", "countryid": "usa", "packagename": "com.abc.xyz" }, { "orderid": "s20230210kr019xxxxx", "purchaseid": "90a5df78f7815623eb34f567eb0413fb0209bb04dad1367d7877edxxxxxxxx", "contentid": "000005059xxx", "countryid": "usa", "packagename": "com.abc.xyz" }, ] } usually, the responses contain all the relevant information about user purchases, such as the in-app product title, price, and payment status. therefore, you can use the information and create views for an easier order management. noteif the iap operating mode is configured to test mode, the api response is empty. this is because the api is configured to operate and return a response only in production mode. conclusion you have learned how to implement product purchase, consumption, and registration, as well as how to integrate the samsung iap orders api and configure a server to fetch all the payment and refund history within specific dates. integrating the samsung iap orders api functionality into your server is an essential step in managing your application payments history to ensure a seamless experience to users. now, you can implement the samsung iap orders api into your application to track all payments, refunds and make your business more manageable. related resources for additional information on this topic, see the resources below: android sample application source code sample server application source code add samsung in-app purchase service to your app samsung iap orders api integration of samsung iap services in android apps
Md. Hossain
tutorials
blogintroduction the samsung iap subscription server apis empower developers to efficiently manage samsung in-app purchase (iap) subscriptions, including cancellation, refund, revocation, and status check. these apis serve as the foundation for implementing subscription management features within your application management server. integrating the samsung iap server apis with your backend server simplifies subscription management. this integration allows you to cancel subscriptions and prevent further billing for users, revoke access to subscription-based content, process refunds based on user requests, and check subscription status to determine validity and current state. a well-structured backend implementation streamlines subscription management, ensuring customers receive reliable service and minimizing potential issues related to billing, access, and refunds. prerequisites to establish server-to-server communication between the samsung iap service and your server, follow these essential steps. develop a subscription application – ensure your application supports subscription operations. upload binary for beta testing – submit your application for testing in seller portal. create subscriptions – set up subscription products in seller portal for user subscriptions. completing these steps ensures a seamless integration of samsung iap into your application. for detailed guidance, visit register an app and in-app items in seller portal. implementation of the samsung subscription apis the samsung iap subscription server apis are used to manage subscription-related operations, including cancellations, revocations, refunds, and status checks. to leverage these apis effectively, setting up a backend server is essential. this secure server-to-server communication facilitates efficient handling of all subscription-related operations between the samsung iap service and your server. api overview the samsung iap subscription server api provides endpoints for efficiently managing subscription-based operations. it allows developers to cancel, revoke, refund, and check the status of subscriptions. this api also facilitates robust operations and efficient management of user subscriptions, all while ensuring security and authentication through the use of appropriate headers. base endpoint the samsung iap subscription server apis need a secure endpoint for managing subscriptions. https://devapi.samsungapps.com/iap/seller/v6/applications/<packagename>/purchases/subscriptions/<purchaseid> more detailed information is available through the support documentation. headers to ensure secure communication with the samsung iap service, the following headers must be included in every request. content-type – defines the format of the request body. for json content, use application/json. authorization – uses an access token for authentication. the format should be (bearer <access_token>). refer to the create an access token page for details on generating an access token. service account id – obtained from seller portal under assistance > api service. this id is required to generate a json web token (jwt). for more detailed information, visit the create a service account section in seller portal. these headers collectively ensure secure and authenticated api requests, enabling seamless integration with the samsung iap service. supported methods the samsung iap subscription server api enables efficient subscription management. developers can cancel, revoke, or refund subscriptions using patch requests, and check subscription status using get requests. configuring the server you can develop a spring boot server for this purpose. here are the guidelines for setting it up. create a spring boot project - for detailed steps, refer to developing your first spring boot application. set up the server endpoint: create a controller for samsung iap subscription apis within your ide after importing the spring boot project. this controller manages all in-app subscription activities. the controller performs patch and get requests with the samsung iap service, ensuring communication with your server. performing a patch request the patch request is used to cancel, refund, or revoke a subscription. follow these steps to proceed. creating a request body to cancel, refund, or revoke a subscription, a specific request body must be created for each operation. when interacting with samsung iap service, you send a well-structured api request tailored to the specific action you wish to execute. below are the request formats for various subscription operations. // cancel a subscription requestbody body = requestbody.create( mediatype.parse("application/json"), "{\"action\" : \"cancel\"}" ); // revoke a subscription requestbody body = requestbody.create( mediatype.parse("application/json"), "{\"action\" : \"revoke\"}" ); // refund a subscription requestbody body = requestbody.create( mediatype.parse("application/json"), "{\"action\" : \"refund\"}" ); building the patch request (cancel, revoke or refund subscription) the patch method in rest apis is used for partial updates of resources, enabling you to send only the specific fields that need modification rather than the entire resource. the patch request needs a request body to specify the intended action. to execute a subscription management request, you must construct a secure http request that includes all necessary headers and authentication details. request request = new request.builder() .url(api_url) .patch(body) .addheader("content-type", "application/json") .addheader("authorization", "bearer " + access_token) .addheader("service-account-id", service_account_id) .build(); executing the patch request once the patch request is prepared, execute it using the okhttpclient, ensuring proper request handling and response processing. @crossorigin(origins = "*") @requestmapping(value = "/cancel", method = requestmethod.patch ) public void patchrequest(){ // set request body as json with required action. // initialize patch request, set body, add headers, and finalize setup. client.newcall(request).enqueue(new callback() { @override public void onfailure(call call, ioexception e) { // handle exception } @override public void onresponse(call call, response response) throws ioexception { // handle response response.close(); } }); } example response this response indicates that the request was processed successfully and without errors. { "code" : "0000", "message" : "success" } performing a get request the get request is used to retrieve the status of a subscription. follow these steps to proceed. building the get request the get method is primarily used to retrieve or read data from a server. to check the status of a subscription, the get method is required to retrieve detailed item information. this type of request does not require a request body; only the necessary headers for authentication are needed. request request = new request.builder() .url(api_url) .addheader("content-type", "application/json") .addheader("authorization", "bearer " + access_token) .addheader("service-account-id", service_account_id) .build(); executing the get request once the get request is prepared, execute it using the okhttpclient to retrieve and efficiently process the response data. @getmapping("/get") public void getrequest(){ // initialize get request, add headers, and finalize setup. client.newcall(request).enqueue(new callback() { @override public void onfailure(call call, ioexception e) { // handle exception } @override public void onresponse(call call, response response) throws ioexception { // handle response } }); } example response if the get request executes successfully, it returns the status of the subscription as a response. { "subscriptionpurchasedate": "2025-04-28 04:54:06 utc", "subscriptionenddate": "2025-04-28 05:54:06 utc", "subscriptionstatus": "cancel", "subscriptionfirstpurchaseid": "55541a3d363c9dee6194614024ee2177c72a9dec51fe8dba5b44503f57dc9aec", "countrycode": "usa", "price": { "localcurrencycode": "usd", "localprice": 15, "supplyprice": 15 }, ... } deploying and testing the server for the server to perform api calls, it can use a publicly accessible url. you can deploy the project to obtain the url. for testing purposes, you might deploy it on a platform like codesandbox, which provides a publicly accessible url similar to https://abcde-8080.csb.app/iap/xxxx. conclusion by properly integrating the samsung iap subscription server apis, developers can ensure seamless handling of subscription-related actions within their applications. the implementation of secure server-to-server communication guarantees efficient subscription management and significantly enhances the overall user experience. references download sample server source code samsung iap subscription documentation integrate the samsung in-app purchase orders api with your application
Md. Hossain
Develop Samsung IAP
docsamsung iap orders api the samsung in-app purchase iap orders api is used to view all payments and refunds on a specific date before you can start using the iap orders api, you must meet all requirements and use the required authorization header parameters in your requests see get started with the iap apis for more information view payments and refunds view all payments and refunds on a specific date request post /iap/seller/orders name type description sellerseq string required your seller deeplink in seller portal, a 12-digit number to find your seller deeplink, log in to seller portal and go to profile > information for seller page packagename string optional the package name of the app for which you want to view payment and refund data if no packagename is specified, data is returned for all apps to find an app's package name, log in to seller portal, go to apps, select the app, open the binary tab, and click the file name requestdate string optional the specific day for which you want to view payments and refunds if no date is specified, yesterday's date is used format yyyymmdd continuationtoken string optional request the next page of payment/refund data a page contains up to 100 products if a continuationtoken is not specified, the first page of data is displayed if more than one page of data is available, the response includes a continuationtoken use this token to request the next page of data if the continuationtoken returned in the response is null, this means the previous page of data is the last page to contain product information curl \ -x post \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ -d '{"sellerseq" "000123456789","packagename" "com samsung android sample","requestdate" "20230615","continuationtoken" "e5ec039730164c50277f9a231b74c1b6e035d9184160d8b3d6b3de1f62691328fbe4c0c4863da52b3bcecef44a4c7acb974c674728c3cb173cb339bd41783f2c"}' \ "https //devapi samsungapps com/iap/seller/orders" use cases parameters included data retrieved sellerseq yesterday's payments and refunds for all apps sellerseq, packagename yesterday's payments and refunds for the specified app sellerseq, requestdate payments and refunds for all apps for the specified date sellerseq, packagename, requestdate payments and refunds for the specified app and the specified date response parameters name type description continuationtoken string if more than 1 page of data 100 products is available to view, a continuationtoken is sent in order to request and view the next page of data if the continuationtoken is null, this means the previous page of data is the last page to contain product information orderid string unique identifier assigned to the purchase receipt purchaseid string unique identifier of the in-app product purchase transaction contentid string content id of the application registered in seller portal countryid string three-character country code iso 3166 of the country where the product is sold packagename string package name of the application registered in seller portal itemid string unique identifier of the in-app product registered in seller portal itemtitle string title of the in-app product registered in seller portal status string order status 2 payment successfully completed3 payment canceled refund if you want to test the "payment canceled" status, contact customer support at seller portal > help > contact us > contact us at the customer center include the orderid of the purchase so that we can change the order status to "payment canceled " ordertime datetime timestamp utc when the order was requested completiontime datetime timestamp utc when the payment was successfully completed refundtime datetime timestamp utc when the payment was canceled by the admin localcurrency string currency symbol of the country's currency where the product was purchased for example, $ localcurrencycode string three-character currency code iso 4217 of the country's currency where the product was purchased for example, eur, gbp, usd localprice string price of the product in the country where the product was purchased usdprice string price in u s dollars usd exchangerate string usd exchange rate at the time of purchase mcc string sim card country code subscriptionorderid string if the purchased product is a subscription, the origin order id of the subscription freetrialyn string if the subscription is purchased during a free trial period y the subscription was purchased during a free trial period n the subscription was not purchased during a free trial period tieredsubscriptionyn string if the subscription is purchased as a lower-tier/introductory or regular-tier/regular subscription y the subscription was purchased as a lower-tier or introductory subscription n the subscription was purchased as a regular-tier or regular subscription { "continuationtoken" "5b5496f44417c9f6b42c8768cbd3f5b5621cdd4021308af81c1e49b77602e9074ab", "orderitemlist" [ { "orderid" "s20230210kr01922227", "purchaseid" "a778b928b32ed0871958e8bcfb757e54f0bc894fa8df7dd8dbb553c81b048343", "contentid" "000005059222", "countryid" "usa", "packagename" "com samsung android sample" }, { "orderid" "s20230210kr01922227", "purchaseid" "90a5df78f7815623eb34f567eb0413fb0209bb04dad1367d7877edfa136321", "contentid" "000005059222", "countryid" "usa", "packagename" "com samsung android sample" }, ] } see failure response codes for a list of possible response codes when a request fails failure response codes the following are response codes you may see when the request fails status code and message 400bad request slr_4001 seller is not matchedslr_4009 continuation token is invalidslr_4010 decrypted continuation token consists of invalid data typeslr_4011 date format is invalid use the format yyyymmdd 401unauthorized slr_4008 failed to verify gateway server authorization
Develop Samsung IAP
docget started with the samsung iap apis the samsung in-app purchase iap apis provide the following functionality orders - view payments and refunds for a specific date publish - view, register, modify, and remove iap products purchase acknowledgment - consume or acknowledge a purchased product subscription - cancel, refund, revoke or check the status of iap subscriptions to start using the iap apis, you must meet certain requirements and use the required authorization header parameters described below requirements in order to use the iap apis, the following is required the iap apis are part of the galaxy store developer api you must meet all of the requirements of the galaxy store developer api including, but not limited to, creating the access token, including the access token in the authorization header of every iap api call, and having commercial seller status to manage in-app purchase products the iap apis must be connected with the content in the in app purchase tab area of seller portal to create this connection, you must either initially distribute your content using the content publish api or the content must be in the for sale state in seller portal if this connection does not exist, matching product information cannot be retrieved you must integrate the iap sdk into your app all binaries registered in your content must support iap if these requirements are not met, error code 106 is returned authorization header parameters every request must include authorization header parameters which specify the content type, your access token, and service account id see create an access token for more information about how to create an access token and service account id attribute description authorization required use bearer <your-access-token> where <your-access-token> is the access token you requested from the galaxy store authentication server service-account-id required the service account id used to create the jwt associated with the access token can be found in the assistance > api service area of seller portal content-type required must be application/json the following example shows the header used with the iap apis curl -x <iap_publish-or-iap_order-or-iap_subscription_api_request> \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" url path parameters the url path for every iap publish and subscription api request must contain the package name for the iap orders api, the package name may be required in the body parameter for the iap subscription api, the in-app product purchase transaction identifier is also required attribute description packagename required for iap order and subscription apis the app's package name purchaseid required for iap subscription api unique identifier of the in-app product purchase transaction the following example shows the url path for creating an in-app product using the iap publish api https //devapi samsungapps com/iap/v6/applications/<packagename>/items the following example shows the url path for canceling, refunding, or revoking a subscription using the iap subscription api https //devapi samsungapps com/iap/seller/v6/applications/<packagename>/items/purchases/subscriptions/<purchaseid>
tutorials
blogin-app purchases are crucial for many applications, and the samsung in-app purchase (iap) service helps developers manage purchases, subscriptions, and refunds efficiently. to keep your server in sync with user transactions, samsung iap instant server notification (isn) sends real-time notifications to your backend server when purchase-related events occur. isn for samsung iap is a method used by samsung's system to notify your server about user activities related to in-app items and subscriptions. when a change occurs, samsung sends a notification to your server. a list of all events that trigger a notification is available here. in this article, we will build a spring boot server that handles these notifications. prerequisites to implement isn for samsung iap, it is important to focus on the requirements that helps you to most easily implement the process: create an iap public key in the seller portal. this key is used to authenticate the notifications you receive and verify that they are from the samsung iap isn system. the steps you need to follow are outlined in the create an iap public key in seller portal documentation. create an in-app item in the seller portal. follow the related documentation to create an in-app item. isn structure the isn for samsung iap service sends a notification to the application developer server. the structure of the notification is always a base64-encoded json web token (jwt) and consists of three parts. the three parts are: header payload signature header the jwt uses a jose (javascript object signing and encryption) header. similar to the envelope of a letter, the header indicates the type of notification being sent. for additional information, refer to the samsung iap isn header article. example encoded header: eyj0exaioijkv1qilcjhbgcioijsxxxxxxxx example decoded header: { "alg" : "rs256", "typ" : "jwt" } payload the payload is the actual content of the message, like the letter inside the envelope. this part contains the crucial information you need, like the user’s subscription details, the product they have subscribed to, and the current status of the subscription. more details about the payload check are available in the following documentation and data claims section. example encoded payload: eyjpc3mioijpyxauc2ftc3vuz2fwchmuy29tiiwic3viijoirvzftlrftkfnrsisimf1zci6wyjjb20ucgfja2fnzs5uyw1lil0sim5izii6mtcxnziwncwiawf0ijoxnze3mja0lcjkyxrhijp7innlbgxlck5hbwuiom51bgwsim nvbnrlbnroyw1lijoitwfydgluzsj9lcj2zxjzaw9uijoxxxxxxxx example decoded payload: { "iss": "iap.samsungapps.com", "sub": "event_name", "aud": ["com.package.name"], "nbf": 1717xxxxxx, "iat": 1717xxxxxx, "data": {..}, "version": "x.0" } signature the signature is the security feature that acts as a digital stamp to prove the message is genuine and hasn’t been tampered with. you can use this signature to verify that the data in the payload is authentic and was created by samsung. further information is provided in the signature documentation. now that we know the structure of the isn for samsung iap, we can configure the server to handle it. server configuration according to the isn for samsung iap requirements, you must set up a server to receive the notifications. below, we create a spring boot server. use your preferred ide (integrated development environment) or online spring initializr to create a spring boot server. follow the steps below to set up your own server. step 1: set up a spring boot project use the spring initializr tool to create a new project. choose the following dependency: spring web generate and download the project. step 2: import the project into ide open the project in the ide (intellij, eclipse, etc.) step 3: set up isn endpoint create a controller for isn notifications in the ide after importing the spring boot project. the controller receives post requests (subscription, refund and cancel) sent from samsung’s iap server. add necessary dependencies in the build.gradle file: { implementation 'com.auth0:java-jwt:4.0.0' //for jwt verifier implementation 'org.json:json:20230227' // for json parsing } load the public key detailed in the prerequisite section: private string loadpublickey(string filename) throws ioexception { classpathresource resource = new classpathresource(filename); stringbuilder contentbuilder = new stringbuilder(); try (inputstream inputstream = resource.getinputstream(); bufferedreader reader = new bufferedreader(new inputstreamreader(inputstream))) { string line; while ((line = reader.readline()) != null) { contentbuilder.append(line).append("\n"); } } return contentbuilder.tostring(); } remove headers, footers, and whitespace from the public key and convert it to the rsapublickey format. private rsapublickey getrsapublickeyfrompem(string pem) throws exception { string publickeypem = pem .replace("-----begin public key-----", "") .replace("-----end public key-----", "") .replaceall("\\s", ""); // remove headers, footers, and whitespace byte[] encoded = base64.getdecoder().decode(publickeypem); keyfactory keyfactory = keyfactory.getinstance("rsa"); x509encodedkeyspec keyspec = new x509encodedkeyspec(encoded); return (rsapublickey) keyfactory.generatepublic(keyspec); } create a jwt verifier with rsapublickey and, finally, verify the jwt. if the verification is successful, decode the jwt to retrieve the decoded json payload. the decoded payload contains the message of the notification. private void verifytoken(string token, rsapublickey publickey) { try { // create jwt verifier with rsa public key algorithm algorithm = algorithm.rsa256(publickey, null); // verify the jwt token jwtverifier verifier = jwt.require(algorithm) .withissuer("iap.samsungapps.com") .build(); decodedjwt jwt = verifier.verify(token); // decode the jwt token string payloadjson = new string(base64.getdecoder().decode(jwt.getpayload())); jsonobject jsonobject = new jsonobject(payloadjson); //print decoded json payload system.out.println("payload as json: " + jsonobject.tostring(4)); } catch (jwtverificationexception e) { system.out.println("invalid token: " + e.getmessage()); } } in this sample project, we have only printed the payload data to the console. you can use this according to your requirements. step 4: deploy the server the server needs a publicly accessible url to receive isn notifications. in our project, we have used codesandbox to get the publicly accessible url for the server. once you deploy the project on codesandbox, you will get a publicly accessible url that looks like this: https://abcde-8080.csb.app/iap/isn. testing with seller portal test your server with samsung galaxy store seller portal: set the codesandbox url as the isn url in seller portal. go to the in-app purchase section and create items with the required details. in the "isn url" field, set the publicly accessible server url. after setting the url, click the test button. a notification will be sent to the specified server immediately. you will also receive a notification on the server that you just deployed in the codesandbox. figure 1: testing with seller portal testing with a sample application now it is time to test the isn for samsung iap from the user application. further details are provided in the integrate the samsung in-app purchase orders api with your application article. download the sample application from this blog and then follow the instructions until you reach the "implementation of item subscription" section. in the sample application, after clicking the "buy" button, startpayment() is called. the onpayment() callback returns an indication of whether the purchase succeeds or fails. if the purchase is successful, the iap server sends a notification to your server. iaphelper.startpayment(itemid, string.valueof(1), new onpaymentlistener() { @override public void onpayment(@nonnull errorvo errorvo, @nullable purchasevo purchasevo) { if (purchasevo != null) { log.d("purchaseid" , purchasevo.getpurchaseid().tostring()); // purchase successfull }else { log.d("purchaseerror" , errorvo.tostring()); } } }); example response after successfully purchasing an item, a json response is returned. for more information on each parameter, you can check the item purchased documentation. example json response: "data" : { "itemid": "example_item_id", "orderid": "xxxx40601kra00xxxxx", "purchaseid": "xxxxx7245d57cc1ba072b81d06e6f86cd49d3da63854538eea689273787xxxxx", "testpayyn": "n", "betatestyn": "n", "passthroughparam": null } notefor different event types, it sends different data claims. for more detailed information regarding data claims, see data claims. conclusion by implementing the isn for samsung iap with your server, you can easily and securely stay in sync with user in-app purchases. integrating isn for samsung iap helps you improve your application management experience and grow your application’s revenue. following this guide will help you smoothly set up the system and provide a better way to manage your application. references for additional information on this topic, see the resources below: download the sample spring boot server samsung iap instant server notification documentation integrate the samsung in-app purchase orders api with your application
Md. Hossain
Develop Smart TV
apivoiceinteraction api to use samsung product api, <script type="text/javascript" src="$webapis/webapis/webapis js"></script> should be loaded in index html samsung tvs allow developers to use voice commands such as navigation, search, selection and media control to control their application the voice assistant in the tv can be bixby or other assistants regardless of which assistant is used, the application will interact with it via the voice interaction apis for best results, we recommend the application to be implemented with all the features that are described in this document since 6 0 product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol summary of interfaces and methods interface method voiceinteractionmanagerobject voiceinteractioncallback optional voiceapplicationstate onupdatestate ;optional boolean onnavigation voicenavigation voicenavigation ;optional boolean onsearch voicesearchterm voicesearchterm ;optional boolean onplay ;optional boolean onstop ;optional boolean onpause ;optional boolean onexit ;optional boolean onselection long voiceselection ;optional boolean ontitleselection domstring title ;optional boolean onfastforward ;optional boolean onrewind ;optional domstring onsearchcollection voicesearchterm voicesearchterm ;optional boolean onchangeappstate voiceapplicationstate state ;optional boolean onchangeprevioustrack ;optional boolean onchangenexttrack ;optional boolean onrestart ;optional boolean onskipbackward long offsetseconds ;optional boolean onskipforward long offsetseconds ;optional boolean onsetplayposition long position ;optional boolean onchangesubtitlemode mediafunctionmode mode ;optional boolean onchangeshufflemode mediafunctionmode mode ;optional boolean onchangescreenfitmode mediafunctionmode mode ;optional boolean onzoom mediazoommode zoom ;optional boolean onrotate mediarotatemode direction ;optional boolean onchange360mode mediafunctionmode mode ;optional boolean onchangerepeatmode mediarepeatmode mode ;optional boolean oncontinuewatching ;optional boolean oncustom domstring jsonobjectstring ;optional domstring onrequestcontentcontext ;optional boolean onadditiontolist listitem list ;optional boolean onremovalfromlist listitem list ;optional boolean onplaylist listitem list ;optional boolean onbrowselist listitem list ;optional boolean onskipad ; voicesearchterm voiceinteractioncontentcontext voiceinteractionmanager domstring getversion ;void setcallback voiceinteractioncallback callback ;void listen ;domstring getdatafromsearchterm voicesearchterm voicesearchterm, voicesearchtermfield field ;domstring buildcollectiondeeplinkdata domstring appid, domstring title, domstring payload ;domstring buildcollectionshowdata domstring appid, domstring title, domstring payload, domstring thumbnail ;voiceinteractioncontentcontext buildvoiceinteractioncontentcontextitem long positionx, long positiony, domstring title, domstring[] aliasarr, boolean bfocused ;domstring buildvoiceinteractioncontentcontextresponse voiceinteractioncontentcontext[] contentcontextarr ; 1 type definitions 1 1 voiceapplicationstate the application status handled via voice interaction enum voiceapplicationstate { "none", "home", "list", "player", "setting", "search", "unknown" }; the following values are supported none application default status home the status of application's home list the status of application showing something in list player the status of application playing something setting the status of application showing its setting search the status of application searching its content unknown the status of unknown 1 2 voicenavigation the navigation via voice interaction enum voicenavigation { "nav_previous", "nav_next", "nav_left", "nav_right", "nav_up", "nav_down", "nav_show_more", "nav_unknown" }; the following values are supported nav_previous the navigation for the previous page nav_next the navigation for the next page nav_left the navigation for the left item nav_right the navigation for the right item nav_up the navigation for the upper item nav_down the navigation for the down item nav_show_more the navigation for the detail page nav_unknown the navigation for unknown 1 3 voicesearchtermfield defines the fields which can be delivered via voice search enum voicesearchtermfield { "search_term_utterance", "search_term_title", "search_term_genre", "search_term_cast", "search_term_content_type", "search_term_release_date_from", "search_term_release_date_to" }; the following values are supported search_term_utterance the field for the full utterance search_term_title the field for the title search_term_genre the field for the genre search_term_cast the field for the cast search_term_content_type the field for the content type movie/tvshow search_term_release_date_from the field for the start date time iso 8601 search_term_release_date_to the field for the end date time iso 8601 1 4 mediafunctionmode enum for the param of media control function mode enum mediafunctionmode { "media_function_on", "media_function_off" }; the following values are supported media_function_on media function mode on media_function_off media function mode off 1 5 mediarotatemode enum for the param of rotate enum mediarotatemode { "media_rotate_left", "media_rotate_right" }; the following values are supported media_rotate_left media rotate mode left media_rotate_right media rotate mode right 1 6 mediazoommode enum for the param of zoom enum mediazoommode { "media_zoom_in", "media_zoom_out" }; the following values are supported media_zoom_in media zoom mode in media_zoom_out media zoom mode out 1 7 mediarepeatmode enum for the param of media repeat enum mediarepeatmode { "media_repeat_off", "media_repeat_one", "media_repeat_all" }; the following values are supported media_repeat_off media repeat mode off media_repeat_one media repeat mode for one track media_repeat_all media repeat mode for all tracks 1 8 listitem enum for the param of list item enum listitem { "list_bookmarks", "list_watch_later", "list_unknown" }; the following values are supported list_bookmarks bookmarks list_watch_later watchlater list_unknown unknown 2 interfaces 2 1 voiceinteractionmanagerobject the voiceinteractionmanagerobject interface defines what is instantiated by the webapis object from the tizen platform there will be a webapis voiceinteraction object that allows access to the functionality of the voice interaction api to use the voice interaction api, the following privileges must be declared in the manifest file of the application if they are not declared, all usage of these apis are blocked, and security exceptions are thrown to use these privileges, the minimum ‘required_version’ is 6 0 [nointerfaceobject] interface voiceinteractionmanagerobject { readonly attribute voiceinteractionmanager voiceinteraction; }; webapi implements voiceinteractionmanagerobject; since 6 0 attributes readonly voiceinteractionmanager voiceinteraction this attribute defines the namespace for voiceinteraction apis 2 2 voiceinteractioncallback every voice interaction application should implement a callback function, so that the assistant can operate the controls your application can interact with voice assistant by passing the callbacks in webapis voiceinteraction setcallback and calling webapis voiceinteraction listen except onupdatestate, onsearchcollection callbacks, the return value for the callback is the boolean flag for support or not if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function [callback, nointerfaceobject] interface voiceinteractioncallback { optional voiceapplicationstate onupdatestate ; optional boolean onnavigation voicenavigation voicenavigation ; optional boolean onsearch voicesearchterm voicesearchterm ; optional boolean onplay ; optional boolean onstop ; optional boolean onpause ; optional boolean onexit ; optional boolean onselection long voiceselection ; optional boolean ontitleselection domstring title ; optional boolean onfastforward ; optional boolean onrewind ; optional domstring onsearchcollection voicesearchterm voicesearchterm ; optional boolean onchangeappstate voiceapplicationstate state ; optional boolean onchangeprevioustrack ; optional boolean onchangenexttrack ; optional boolean onrestart ; optional boolean onskipbackward long offsetseconds ; optional boolean onskipforward long offsetseconds ; optional boolean onsetplayposition long position ; optional boolean onchangesubtitlemode mediafunctionmode mode ; optional boolean onchangeshufflemode mediafunctionmode mode ; optional boolean onchangescreenfitmode mediafunctionmode mode ; optional boolean onzoom mediazoommode zoom ; optional boolean onrotate mediarotatemode direction ; optional boolean onchange360mode mediafunctionmode mode ; optional boolean onchangerepeatmode mediarepeatmode mode ; optional boolean oncontinuewatching ; optional boolean oncustom domstring jsonobjectstring ; optional domstring onrequestcontentcontext ; optional boolean onadditiontolist listitem list ; optional boolean onremovalfromlist listitem list ; optional boolean onplaylist listitem list ; optional boolean onbrowselist listitem list ; optional boolean onskipad ; }; since 6 0 methods onupdatestate developers must specify the current application status to the onupdatestate function to get a proper voice control from the voice assistant this function is called right before processing every utterance, so that the voice assistant can be aware of the application status dynamically depending on the status, the callback function called could be different therefore, it is important to return the real status of the application optional voiceapplicationstate onupdatestate ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional voiceapplicationstate the status of the current application status "none" application is in its default status same as "player" status "list" the application is showing something in list during this status, the utterances "play this" or "play" will call onselection 0 the utterance "previous" will call onnavigation "nav_previous" "player" the application is playing a piece of content during this status, the utterance "play this" will call onplay since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "list"; } } ; onnavigation to support navigation controls via voice, the application should have the following callbacks otherwise, the key event will be generated optional boolean onnavigation voicenavigation voicenavigation ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters voicenavigation the navigation enumeration via voice return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "list"; }, onnavigation function voicenavigation { var bsupport = true; console log "onnavigation " + voicenavigation ; switch voicenavigation { case "nav_previous " // "previous page" break; case "nav_next" // "next page" break; case "nav_left" // "go to left" break; case "nav_right" // "move to right" break; case "nav_up" // "move up" break; case "nav_down" // "go down" break; // if there is no callback implementation for these enums, // tv will generate remote control key events "arrowright", "arrowleft", "arrowup", "arrowdown" case "nav_show_more" // "show me more" break; default bsupport = false; break; } return bsupport; } } ; onsearch for a contents search provided by the application, it can receive a search utterance to show the search results in order to support the search via voice, the application must be registered to samsung tv's companion search application and have the following callbacks the onsearch parameter has a specific format to learn more about it, please refer to the getdatafromsearchterm some callbacks are not called by default such as onsearch to receive all the callback signals on the development stage, request a key from samsung and apply the key to the manifest of your tizen application the following example shows how to add the "http //developer samsung com/tizen/metadata/support-vif-devfeature" key to the manifest file optional boolean onsearch voicesearchterm voicesearchterm ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters voicesearchterm the object contains the information via voice return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example <?xml version="1 0" encoding="utf-8"?> <widget xmlns="http //www w3 org/ns/widgets" tizen="http //tizen org/ns/widgets" id="http //yourdomain/voiceinteractionwebsample" version="1 0 0" viewmodes="maximized"> <access origin="" subdomains="true"></access> < application id="abcdefghrj voiceinteractionwebsample" package="abcdefghrj" required_version="6 0"/> <content src="index html"/> <feature name="http //tizen org/feature/screen size normal 1080 1920"/> <icon src="icon png"/> < metadata key="http //developer samsung com/tizen/metadata/support-vif-dev-feature" value="true"/> <name>voiceinteractionwebsample</name> < privilege name="http //developer samsung com/privilege/voicecontrol"/> < privilege name="http //developer samsung com/privilege/microphone"/> < profile name="tv-samsung"/> </widget> @endcode @param voicesearchterm the object contains the information via voice @see getdatafromsearchterm @throw none n/a @return boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function @code webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "home"; }, onsearch function voicesearchterm { console log "onsearch " + json stringify voicesearchterm ; var title = webapis voiceinteraction getdatafromsearchterm voicesearchterm, "search_term_title" ; var genre = webapis voiceinteraction getdatafromsearchterm voicesearchterm, "search_term_genre" ; console log "request to search " + title + ", " + genre ; return true; } } ; onplay supports the media control to handle playback play optional boolean onplay ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "player"; }, onplay function { // tv default action generates the remote control key, "mediaplay" console log "onplay called" ; return true; } } ; onstop supports the media control to handle playback stop optional boolean onstop ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "player"; }, onstop function { // tv default action generates the remote control key, "mediastop" console log "onstop called" ; return true; } } ; onpause supports the media control to handle playback pause optional boolean onpause ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "player"; }, onpause function { // tv default action generates the remote control key, "mediaplaypause" console log "onpause called" ; return true; } } ; onexit supports the media control to handle playback exit optional boolean onexit ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "player"; }, onexit function { // tv default action generates the remote control key, "exit" console log "onexit called" ; return true; } } ; onselection to support selection controls via voice, the application should have the following callbacks this callback supports the ordinal, relative selection control optional boolean onselection long voiceselection ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters voiceselection the relative index via voice, ex the last item is -1, the current item is 0, the first item is 1 return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "list"; }, onselection function voiceselection { var bsupport = true; console log "onselection " + voiceselection ; switch voiceselection { case -1 // "select the last one" break; case 0 // "select this" break; default { if voiceselection >= 1 // "select the first one" { // select the voiceselection th item // index of the first item is 1 console log "for ordinal " + voiceselection ; } else { bsupport = false; } } break; } return bsupport; } } ; ontitleselection title selection refers to an utterance in the format "select {title name}" to support the title selection via voice, the following two callbacks are required onrequestcontentcontext and ontitleselection the onrequestcontentcontext callback provides the information regarding the content of the screen such as title and position to the samsung tv this method will be invoked at the beginning of every utterance the response consists of positionx int , positiony int , title string , alias string array and bfocused bool the title property is used for asr conversion and the other properties are used to set the priority of each title the ontitleselection callback receives the title name from the utterance optional boolean ontitleselection domstring title ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters title the string input via voice return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "list"; }, onrequestcontentcontext function { console log "onrequestcontentcontext " ; var result = []; try { var item = { "positionx" 0, "positiony" 0, "title" "title text1", "alias" ["title1", "my text1"], "bfocused" true }; result push item ; var item2 = { "positionx" 1, "positiony" 0, "title" "title text2", "alias" ["title2", "my text2"], "bfocused" false }; result push item2 ; result push webapis voiceinteraction buildvoiceinteractioncontentcontextitem 2,0,"title text3", ["title3", "my text3"], false ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } return webapis voiceinteraction buildvoiceinteractioncontentcontextresponse result ; }, ontitleselection function title { console log "ontitleselection" + title ; return true; } } ; onfastforward supports the media control to handle playback ff optional boolean onfastforward ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "player"; }, onfastforward function { // tv default action generates the remote control key, "mediafastforward" console log "onfastforward called" ; return true; } } ; onrewind supports the media control to handle playback rewind optional boolean onrewind ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "player"; }, onrewind function { // tv default action generates the remote control key, "mediarewind" console log "onrewind called" ; return true; } } ; onsearchcollection supports the search utterance appending to the default search application the value of the result for the search term optional domstring onsearchcollection voicesearchterm voicesearchterm ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters voicesearchterm the object contains the information via voice return value optional domstring the formatted value of the result for the search term since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "none"; }, onsearchcollection function voicesearchterm { log "onsearchcollection " + json stringify voicesearchterm ; var result = []; //appname and appid are of the ui application to get the payload on launch result push webapis voiceinteraction buildcollectiondeeplinkdata "a1b2c3d4ef mytizenappid", "mytizenapp", "page_id=123456&method=voice" ; return json stringify result ; } } ; onchangeappstate to support the utterance of shortcut commands, the application must have the onchangeappstate callback optional boolean onchangeappstate voiceapplicationstate state ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters state the application context via voice return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "none"; }, onchangeappstate function state { // tv default action launches the samsung tv firstscreen, menu or search application depending on the input parameter // "go to home", "go to settings", "go to search" console log "onchangeappstate " + state ; var bsupport = true; switch state { case "home" // go to app's home break; default bsupport = false; break; } return bsupport; } } ; onchangeprevioustrack in order to handle requests to move to the previous track via voice, the application should override the onchangeprevioustrack callback optional boolean onchangeprevioustrack ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onchangeprevioustrack function { console log "onchangeprevioustrack" ; return true; } } ; onchangenexttrack in order to handle requests to move to the next track via voice, the application should override the onchangenexttrack callback optional boolean onchangenexttrack ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onchangenexttrack function { console log "onchangenexttrack" ; return true; } } ; onrestart in order to handle requests to restart to this track via voice, the application should override the onrestart callback optional boolean onrestart ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onrestart function { console log "onrestart" ; return true; } } ; onskipbackward in order to handle requests to skip backward via voice, the application should override the onskipbackward callback optional boolean onskipbackward long offsetseconds ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters offsetseconds the relative position in seconds return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onskipbackward function offsetseconds { console log "onskipbackward " + offsetseconds ; return true; } } ; onskipforward in order to handle requests to skip forward via voice, the application should override the onskipforward callback optional boolean onskipforward long offsetseconds ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters offsetseconds the relative position in seconds return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onskipforward function offsetseconds { console log "onskipforward " + offsetseconds ; return true; } } ; onsetplayposition in order to handle requests to set play position via voice, the application should override the onsetplayposition callback optional boolean onsetplayposition long position ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters position the absolute position in seconds return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onsetplayposition function position { console log "onsetplayposition " + position ; return true; } } ; onchangesubtitlemode in order to handle requests to turn the subtitle feature on/off via voice, the application should override the onchangesubtitlemode callback optional boolean onchangesubtitlemode mediafunctionmode mode ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters mode media_function_on turning on / media_function_off turning off return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onchangesubtitlemode function mode { console log "onchangesubtitlemode" ; switch mode { case "media_function_on" console log "function on" ; break; default console log "function off" ; break; } return true; } } ; onchangeshufflemode in order to handle requests to turn the shuffle feature on/off via voice, the application should override the onchangeshufflemode callback optional boolean onchangeshufflemode mediafunctionmode mode ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters mode media_function_on turning on / media_function_off turning off return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onchangeshufflemode function mode { console log "onchangeshufflemode" ; switch mode { case "media_function_on" console log "function on" ; break; default console log "function off" ; break; } return true; } } ; onchangescreenfitmode in order to handle requests to turn the screen fit feature on/off via voice, the application should override the onchangescreenfitmode callback optional boolean onchangescreenfitmode mediafunctionmode mode ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters mode media_function_on turning on / media_function_off turning off return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onchangescreenfitmode function mode { console log "onchangescreenfitmode" ; switch mode { case "media_function_on" console log "function on" ; break; default console log "function off" ; break; } return true; } } ; onzoom in order to handle requests to zoom in/out via voice, the application should override the onzoom callback optional boolean onzoom mediazoommode zoom ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters zoom media_zoom_in zoom in / media_zoom_out zoom out return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onzoom function zoom { console log "onzoom" ; switch zoom { case "media_zoom_in" console log "zoom in" ; break; default console log "zoom out" ; break; } return true; } } ; onrotate in order to handle requests to rotate left/right via voice, the application should override the onrotate callback optional boolean onrotate mediarotatemode direction ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters direction media_rotate_left rotate left / media_rotate_right rotate right return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onrotate function direction { console log "onrotate" ; switch direction { case "media_rotate_left" console log "rotate left" ; break; default console log "rotate right" ; break; } return true; } } ; onchange360mode in order to handle requests to turn the 360 feature on/off via voice, the application should override the onchange360mode callback optional boolean onchange360mode mediafunctionmode mode ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters mode media_function_on turning on / media_function_off turning off return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onchange360mode function mode { console log "onchange360mode" ; switch mode { case "media_function_on" console log "function on" ; break; default console log "function off" ; break; } return true; } } ; onchangerepeatmode in order to handle requests to change the repeat mode via voice, the application should override the onchangerepeatmode callback optional boolean onchangerepeatmode mediarepeatmode mode ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters mode media_repeat_off repeat mode off / media_repeat_one repeat this track / media_repeat_all repeat all tracks return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onchangerepeatmode function mode { console log "onchangerepeatmode" ; switch mode { case "media_repeat_one" console log "one" ; break; case "media_repeat_all" console log "all" ; break; default console log "off" ; break; } return true; } } ; oncontinuewatching in order to handle requests to launch the application with playing the history track via voice, the application should override the oncontinuewatching callback to play the history track this callback will be called after launching the application optional boolean oncontinuewatching ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung device may perform its basic function since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, oncontinuewatching function { console log "oncontinuewatching" ; return true; } } ; oncustom supports the custom voice assistant action optional boolean oncustom domstring jsonobjectstring ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters jsonobjectstring the string stringified json object return value optional boolean boolean value of whether the app supports this feature voice assistant action will get the response "{"result_code" "success"}" for true, "{"result_code" "failure"}" for false/undefined since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "list"; }, oncustom function jsonobjectstring { console log "oncustom " + jsonobjectstring ; try { var customobject = json parse jsonobjectstring ; for var key in customobject { if customobject hasownproperty key { console log "key " + key + ", value " + customobject[key] ; } } } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; return false; } return true; } } ; onrequestcontentcontext in order to support the voice title selection via voice, the application should override the onrequestcontentcontext callback, return the jsonobject string for the current content context list showing optional domstring onrequestcontentcontext ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional domstring domstring containing jsonobject string for the content context list since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "list"; }, onrequestcontentcontext function { log "onrequestcontentcontext " ; var result = []; try { var item = webapis voiceinteraction buildvoiceinteractioncontentcontextitem 1,1,"test", ["test set", "test title"], true ; result push item ; var item2 = webapis voiceinteraction buildvoiceinteractioncontentcontextitem 2,1,"test2", ["test set 2", "test title 2"], false ; result push item2 ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } return webapis voiceinteraction buildvoiceinteractioncontentcontextresponse result ; } } ; onadditiontolist in order to handle requests to add this context to list via voice, the application should override the onadditiontolist callback optional boolean onadditiontolist listitem list ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters list list_bookmarks bookmarks / list_watch_later watch later / list_preference preference / list_subscription subscription return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung tv may perform its basic function since 6 5 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onadditiontolist function list { console log "onadditiontolist" ; switch list { case "list_bookmarks" console log "add this context to bookmarks" ; break; case "list_watch_later" console log "add this context to watch later" ; break; case "list_preference" console log "like this context" ; break; case "list_subscription" console log "subscribe to context" ; break; default break; } return true; } } ; onremovalfromlist in order to handle requests to remove this context from list via voice, the application should override the onremovalfromlist callback optional boolean onremovalfromlist listitem list ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters list list_bookmarks bookmarks / list_watch_later watch later / list_preference preference / list_subscription subscription return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung tv may perform its basic function since 6 5 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onremovalfromlist function list { console log "onremovalfromlist" ; switch list { case "list_bookmarks" console log "remove this context from bookmarks" ; break; case "list_watch_later" console log "remove this context from watch later" ; break; case "list_preference" console log "dislike this context" ; break; case "list_subscription" console log "unsubscribe from this context" ; break; default break; } return true; } } ; onplaylist in order to handle requests to play this context from list via voice, the application should override the onplaylist callback optional boolean onplaylist listitem list ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters list list_preference preference / list_subscription subscription / list_watch_later watch later return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung tv may perform its basic function since 6 5 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onplaylist function list { console log "onplaylist" ; switch list { case "list_preference" console log "play liked content" ; break; case "list_subscription" console log "play subscription content" ; break; case "list_watch_later" console log "play watch later content" ; break; default break; } return true; } } ; onbrowselist in order to handle requests to browse this context from list via voice, the application should override the onbrowselist callback optional boolean onbrowselist listitem list ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters list list_preference preference / list_subscription subscription / list_watch_later watch later return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung tv may perform its basic function since 6 5 code example webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onbrowselist function list { console log "onbrowselist" ; switch list { case "list_preference" console log "browse liked content" ; break; case "list_subscription" console log "browse subscription content" ; break; case "list_watch_later" console log "browse watch later content" ; break; default break; } return true; } } ; onskipad in order to handle requests to skip ad content via voice, the application should override the onskipad callback optional boolean onskipad ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value optional boolean boolean value of whether the app supports this feature if a callback returns the false/undefined value, or there is no callback implementation for the utterance, samsung tv may perform its basic function since 6 5 code example webapis voiceinteraction setcallback { onupdatestate function { return "player"; }, onskipad function { console log "onskipad" ; return true; } } ; 2 3 voicesearchterm this interface represents information about the voice search term [nointerfaceobject] interface voicesearchterm { readonly attribute domstring? utterance; readonly attribute domstring? title; readonly attribute domstring? genre; readonly attribute domstring? cast; readonly attribute domstring? contenttype; readonly attribute domstring? from; readonly attribute domstring? to; }; attributes readonly domstring utterance [nullable] the field for the full utterance readonly domstring title [nullable] the field for the title readonly domstring genre [nullable] the field for the genre readonly domstring cast [nullable] the field for the cast readonly domstring contenttype [nullable] the field for the content type movie/tvshow readonly domstring from [nullable] the field for the start date time iso 8601 readonly domstring to [nullable] the field for the end date time iso 8601 2 4 voiceinteractioncontentcontext this interface represents information about the content context for an item [nointerfaceobject] interface voiceinteractioncontentcontext { attribute long positionx; attribute long positiony; attribute domstring title; attribute boolean bfocused; }; attributes long positionx the field for x-axis position of the item long positiony the field for y-axis position of the item domstring title the field for the title of the item boolean bfocused the field for whether this item has a focus 2 5 voiceinteractionmanager the voiceinteractionmanager interface is the top-level interface for the voiceinteractionmanager api that provides access to the module functionalities [nointerfaceobject] interface voiceinteractionmanager { domstring getversion ; void setcallback voiceinteractioncallback callback ; void listen ; domstring getdatafromsearchterm voicesearchterm voicesearchterm, voicesearchtermfield field ; domstring buildcollectiondeeplinkdata domstring appid, domstring title, domstring payload ; domstring buildcollectionshowdata domstring appid, domstring title, domstring payload, domstring thumbnail ; voiceinteractioncontentcontext buildvoiceinteractioncontentcontextitem long positionx, long positiony, domstring title, domstring[] aliasarr, boolean bfocused ; domstring buildvoiceinteractioncontentcontextresponse voiceinteractioncontentcontext[] contentcontextarr ; }; methods getversion this method gets the plugin's version number domstring getversion ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol return value domstring domstring return value of plugin's version exceptions webapiexception with error type unknownerror in any other error case with error type securityerror, if the application does not have the privilege to call this method since 6 0 code example try { var version = webapis voiceinteraction getversion ; console log "works with voiceinteraction [" + version + "]" ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } setcallback api to define callback functions for the voice interaction commands void setcallback voiceinteractioncallback callback ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters callback composing the functions to be called for the voice interaction commands exceptions webapiexception with error type unknownerror in any other error case with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type securityerror, if the application does not have the privilege to call this method since 6 0 code example try { webapis voiceinteraction setcallback { onupdatestate function { return "list"; }, onnavigation function vn { console log "onnavigation" + vn ; return true; }, onselection function voiceselection { console log "onselection" + voiceselection ; return true; } } ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } listen api to start listening the voice interaction commands after setting callbacks by setcallback void listen ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol exceptions webapiexception with error type unknownerror in any other error case with error type securityerror, if the application does not have the privilege to call this method since 6 0 code example try { webapis voiceinteraction listen ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } getdatafromsearchterm api to parse the searchterm from samsung side domstring getdatafromsearchterm voicesearchterm voicesearchterm, voicesearchtermfield field ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters voicesearchterm the voicesearchterm from samsung side as search term field the field enum to get the value return value domstring the result string formatted exceptions webapiexception with error type unknownerror in any other error case with error type securityerror, if the application does not have the privilege to call this method with error type invalidvalueserror, if any input parameter contains an invalid value with error type typemismatcherror, if an input parameter is not compatible with its expected type since 6 0 code example var title = webapis voiceinteraction getdatafromsearchterm voicesearchterm, "search_term_title" ; var genre = webapis voiceinteraction getdatafromsearchterm voicesearchterm, "search_term_genre" ; buildcollectiondeeplinkdata api to build data for search collection easily domstring buildcollectiondeeplinkdata domstring appid, domstring title, domstring payload ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters appid the app id to be shown in the search application, and to launch the payload title the title to be shown in the search application payload the payload value to be passed with application launch request return value domstring the result string formatted exceptions webapiexception with error type unknownerror in any other error case with error type typemismatcherror, if any input parameter is not domstring type with error type securityerror, if the application does not have the privilege to call this method since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "none"; }, onsearchcollection function voicesearchterm { log "onsearchcollection " + json stringify voicesearchterm ; var result = []; // appname and appid are of the ui application to get the payload on launch try { result push webapis voiceinteraction buildcollectiondeeplinkdata "a1b2c3d4ef mytizenappid", "mytizenapp", "page_id=123456&method=voice" ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } return json stringify result ; } } ; buildcollectionshowdata api to build data for search collection easily domstring buildcollectionshowdata domstring appid, domstring title, domstring payload, domstring thumbnail ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters appid the app id to be shown in the search application, and to launch the payload title the title to be shown in the search application payload the payload value to be passed with application launch request thumbnail the thumbnail url, path to be shown in the search application return value domstring the result string formatted exceptions webapiexception with error type unknownerror in any other error case with error type typemismatcherror, if any input parameter is not domstring type with error type securityerror, if the application does not have the privilege to call this method since 6 0 code example webapis voiceinteraction setcallback { onupdatestate function { console log "assistant tries to get app state" ; return "none"; }, onsearchcollection function voicesearchterm { log "onsearchcollection " + json stringify voicesearchterm ; var result = []; // appname and appid are of the ui application to get the payload on launch try { result push webapis voiceinteraction buildcollectionshowdata "a1b2c3d4ef mytizenappid", "mytizenapp", "page_id=123456&method=voice", "http //myservice com/content/123456 png" ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } return json stringify result ; } } ; buildvoiceinteractioncontentcontextitem api to build the voiceinteractioncontentcontext of an item voiceinteractioncontentcontext buildvoiceinteractioncontentcontextitem long positionx, long positiony, domstring title, domstring[] aliasarr, boolean bfocused ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters positionx x-axis position of the item positiony y-axis position of the item title the title of the item aliasarr the alias titles of the item bfocused whether this item has a focus return value voiceinteractioncontentcontext the voiceinteractioncontentcontext object containing an item showing exceptions webapiexception with error type unknownerror in any other error case with error type typemismatcherror, if any input parameters are not compatible with its expected type since 6 0 code example onrequestcontentcontext function { console log "onrequestcontentcontext " ; var result = []; try { var item = webapis voiceinteraction buildvoiceinteractioncontentcontextitem 1,1,"test", ["test set", "test title"], true ; result push item ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } return webapis voiceinteraction buildvoiceinteractioncontentcontextresponse result ; } buildvoiceinteractioncontentcontextresponse api to build the response of onrequestcontentcontext callback function from voiceinteractioncontentcontext domstring buildvoiceinteractioncontentcontextresponse voiceinteractioncontentcontext[] contentcontextarr ; product tv privilege level public privilege http //developer samsung com/privilege/voicecontrol parameters contentcontextarr voiceinteractioncontentcontext objects of the items showing return value domstring the domstring of jsonobject string containing the items showing exceptions webapiexception with error type unknownerror in any other error case with error type typemismatcherror, if any input parameters are not compatible with its expected type since 6 0 code example onrequestcontentcontext function { console log "onrequestcontentcontext " ; var result = []; try { var item = webapis voiceinteraction buildvoiceinteractioncontentcontextitem 1,1,"test", ["test set", "test title"], true ; result push item ; } catch e { console log "exception [" + e code + "] name " + e name + " message " + e message ; } return webapis voiceinteraction buildvoiceinteractioncontentcontextresponse result ; } 3 full webidl module voiceinteraction { enum voiceapplicationstate { "none", "home", "list", "player", "setting", "search", "unknown" }; enum voicenavigation { "nav_previous", "nav_next", "nav_left", "nav_right", "nav_up", "nav_down", "nav_show_more", "nav_unknown" }; enum voicesearchtermfield { "search_term_utterance", "search_term_title", "search_term_genre", "search_term_cast", "search_term_content_type", "search_term_release_date_from", "search_term_release_date_to" }; enum mediafunctionmode { "media_function_on", "media_function_off" }; enum mediarotatemode { "media_rotate_left", "media_rotate_right" }; enum mediazoommode { "media_zoom_in", "media_zoom_out" }; enum mediarepeatmode { "media_repeat_off", "media_repeat_one", "media_repeat_all" }; enum listitem { "list_bookmarks", "list_watch_later", "list_unknown" }; [nointerfaceobject] interface voiceinteractionmanagerobject { readonly attribute voiceinteractionmanager voiceinteraction; }; webapi implements voiceinteractionmanagerobject; [callback, nointerfaceobject] interface voiceinteractioncallback { optional voiceapplicationstate onupdatestate ; optional boolean onnavigation voicenavigation voicenavigation ; optional boolean onsearch voicesearchterm voicesearchterm ; optional boolean onplay ; optional boolean onstop ; optional boolean onpause ; optional boolean onexit ; optional boolean onselection long voiceselection ; optional boolean ontitleselection domstring title ; optional boolean onfastforward ; optional boolean onrewind ; optional domstring onsearchcollection voicesearchterm voicesearchterm ; optional boolean onchangeappstate voiceapplicationstate state ; optional boolean onchangeprevioustrack ; optional boolean onchangenexttrack ; optional boolean onrestart ; optional boolean onskipbackward long offsetseconds ; optional boolean onskipforward long offsetseconds ; optional boolean onsetplayposition long position ; optional boolean onchangesubtitlemode mediafunctionmode mode ; optional boolean onchangeshufflemode mediafunctionmode mode ; optional boolean onchangescreenfitmode mediafunctionmode mode ; optional boolean onzoom mediazoommode zoom ; optional boolean onrotate mediarotatemode direction ; optional boolean onchange360mode mediafunctionmode mode ; optional boolean onchangerepeatmode mediarepeatmode mode ; optional boolean oncontinuewatching ; optional boolean oncustom domstring jsonobjectstring ; optional domstring onrequestcontentcontext ; optional boolean onadditiontolist listitem list ; optional boolean onremovalfromlist listitem list ; optional boolean onplaylist listitem list ; optional boolean onbrowselist listitem list ; optional boolean onskipad ; }; [nointerfaceobject] interface voicesearchterm { readonly attribute domstring? utterance; readonly attribute domstring? title; readonly attribute domstring? genre; readonly attribute domstring? cast; readonly attribute domstring? contenttype; readonly attribute domstring? from; readonly attribute domstring? to; }; [nointerfaceobject] interface voiceinteractioncontentcontext { attribute long positionx; attribute long positiony; attribute domstring title; attribute boolean bfocused; }; [nointerfaceobject] interface voiceinteractionmanager { domstring getversion ; void setcallback voiceinteractioncallback callback ; void listen ; domstring getdatafromsearchterm voicesearchterm voicesearchterm, voicesearchtermfield field ; domstring buildcollectiondeeplinkdata domstring appid, domstring title, domstring payload ; domstring buildcollectionshowdata domstring appid, domstring title, domstring payload, domstring thumbnail ; voiceinteractioncontentcontext buildvoiceinteractioncontentcontextitem long positionx, long positiony, domstring title, domstring[] aliasarr, boolean bfocused ; domstring buildvoiceinteractioncontentcontextresponse voiceinteractioncontentcontext[] contentcontextarr ; }; };
Develop Smart Hospitality Display
apipreview api to use samsung product api, <script type="text/javascript" src="$webapis/webapis/webapis js"></script> should be loaded in index html this module defines the preview functionalities provided by the tizen samsung product api since 2 3 product tv, av, b2b htv summary of interfaces and methods interface method previewmanagerobject previewmanager void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ;domstring getversion ;bool setactiondataeventlistener deeplinkcallback deeplinkcallback ;void unactiondataeventlistener ; 1 interfaces 1 1 previewmanagerobject defines a webapi object instance of the tizen samsung product api the webapis preview object enables access to preview api functionality [nointerfaceobject] interface previewmanagerobject { readonly attribute previewmanager preview; }; webapi implements previewmanagerobject; attributes readonly previewmanager preview preview api namespace 1 2 previewmanager provides methods for preview functionalities [nointerfaceobject] interface previewmanager { void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ; domstring getversion ; bool setactiondataeventlistener deeplinkcallback deeplinkcallback ; void unactiondataeventlistener ; }; methods setpreviewdata sets the preview data each application can have 1 preview the preview consists of at least 1 section, which contains at least 1 tile prerequisites using tag in config xml for example, <tizen metadata key="http //samsung com/tv/metadata/use preview" value="bg_service"/> void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ; parameters previewdata_json preview properties sections mandatory object properties array title optional string shown at the top of the section position optional number defining the position of the section within the preview panel sections are shown in ascending position order tiles mandatory tile object properties array title optional string shown on a highlighted tile subtitle optional string shown below the title image_url mandatory string with the thumbnail image url the supported formats are png and jpg image_ratio mandatory string defining the thumbnail image aspect ratio the valid strings are "16by9", "4by3", "1by1" default , and "2by3" the thumbnail height is fixed at 250 px action_data mandatory string defining the data to be passed to the application when it is launched from this tile is_playable mandatory boolean defining whether selecting the tile starts media playback if "true", a "play" button icon is shown over the thumbnail image display_from optional timestamp defining the time to begin showing the tile display_until optional timestamp defining the time to stop showing the tile position optional number defining the position of the tile within the section tiles are shown in ascending position order successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke if the request fails exceptions webapiexception with error type invalidvalueserror, if any input parameter contains an invalid value with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type unknownerror, for any other error code example var previewdata = { "sections" [{ "title" "popular now", "tiles" [{ "title" "parks and recreation", "subtitle" "pawnee pony", "display_from" 1422766800, "display_until" 1441937400, "image_url" "http //yourserver com/image jpg", "action_url" "myapp //playvideo?videoid=185595-0324", "is_playable" true }] }] } function successcallback { console log "success" ; } function errorcallback error { console log error message ; } try { webapis preview setpreviewdata json stringify previewdata , successcallback, errorcallback ; } catch ex { console log ex message ; } getversion retrieves the preview api version domstring getversion ; return value domstring plugin version exceptions webapiexception with error type unknownerror, for any error code example try { var result = webapis preview getversion ; console log result ; } catch ex { console log ex message ; } setactiondataeventlistener register callback function which is called when the preview tiles are clicked bool setactiondataeventlistener deeplinkcallback deeplinkcallback ; parameters deeplinkcallback callback method to invoke when action event is occured return value bool output of callback registeration exceptions webapiexception with error type unknownerror, for any error deprecated 4 0 code example this method doesnot have sample code because of @deprecated 4 0 unactiondataeventlistener unregister callback function which is called when the preview tiles are clicked void unactiondataeventlistener ; exceptions webapiexception with error type unknownerror, for any error deprecated 4 0 code example this method doesnot have sample code because of @deprecated 4 0 2 full webidl module preview { [nointerfaceobject] interface previewmanagerobject { readonly attribute previewmanager preview; }; webapi implements previewmanagerobject; [nointerfaceobject] interface previewmanager { void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ; domstring getversion ; bool setactiondataeventlistener deeplinkcallback deeplinkcallback ; void unactiondataeventlistener ; }; };
Develop Smart TV
apipreview api to use samsung product api, <script type="text/javascript" src="$webapis/webapis/webapis js"></script> should be loaded in index html this module defines the preview functionalities provided by the tizen samsung product api since 2 3 product tv, av, b2b htv summary of interfaces and methods interface method previewmanagerobject previewmanager void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ;domstring getversion ;bool setactiondataeventlistener deeplinkcallback deeplinkcallback ;void unactiondataeventlistener ; 1 interfaces 1 1 previewmanagerobject defines a webapi object instance of the tizen samsung product api the webapis preview object enables access to preview api functionality [nointerfaceobject] interface previewmanagerobject { readonly attribute previewmanager preview; }; webapi implements previewmanagerobject; attributes readonly previewmanager preview preview api namespace 1 2 previewmanager provides methods for preview functionalities [nointerfaceobject] interface previewmanager { void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ; domstring getversion ; bool setactiondataeventlistener deeplinkcallback deeplinkcallback ; void unactiondataeventlistener ; }; methods setpreviewdata sets the preview data each application can have 1 preview the preview consists of at least 1 section, which contains at least 1 tile prerequisites using tag in config xml for example, <tizen metadata key="http //samsung com/tv/metadata/use preview" value="bg_service"/> void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ; parameters previewdata_json preview properties sections mandatory object properties array title optional string shown at the top of the section position optional number defining the position of the section within the preview panel sections are shown in ascending position order tiles mandatory tile object properties array title optional string shown on a highlighted tile subtitle optional string shown below the title image_url mandatory string with the thumbnail image url the supported formats are png and jpg image_ratio mandatory string defining the thumbnail image aspect ratio the valid strings are "16by9", "4by3", "1by1" default , and "2by3" the thumbnail height is fixed at 250 px action_data mandatory string defining the data to be passed to the application when it is launched from this tile is_playable mandatory boolean defining whether selecting the tile starts media playback if "true", a "play" button icon is shown over the thumbnail image display_from optional timestamp defining the time to begin showing the tile display_until optional timestamp defining the time to stop showing the tile position optional number defining the position of the tile within the section tiles are shown in ascending position order successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke if the request fails exceptions webapiexception with error type invalidvalueserror, if any input parameter contains an invalid value with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type unknownerror, for any other error code example var previewdata = { "sections" [{ "title" "popular now", "tiles" [{ "title" "parks and recreation", "subtitle" "pawnee pony", "display_from" 1422766800, "display_until" 1441937400, "image_url" "http //yourserver com/image jpg", "action_url" "myapp //playvideo?videoid=185595-0324", "is_playable" true }] }] } function successcallback { console log "success" ; } function errorcallback error { console log error message ; } try { webapis preview setpreviewdata json stringify previewdata , successcallback, errorcallback ; } catch ex { console log ex message ; } getversion retrieves the preview api version domstring getversion ; return value domstring plugin version exceptions webapiexception with error type unknownerror, for any error code example try { var result = webapis preview getversion ; console log result ; } catch ex { console log ex message ; } setactiondataeventlistener register callback function which is called when the preview tiles are clicked bool setactiondataeventlistener deeplinkcallback deeplinkcallback ; parameters deeplinkcallback callback method to invoke when action event is occured return value bool output of callback registeration exceptions webapiexception with error type unknownerror, for any error deprecated 4 0 code example this method doesnot have sample code because of @deprecated 4 0 unactiondataeventlistener unregister callback function which is called when the preview tiles are clicked void unactiondataeventlistener ; exceptions webapiexception with error type unknownerror, for any error deprecated 4 0 code example this method doesnot have sample code because of @deprecated 4 0 2 full webidl module preview { [nointerfaceobject] interface previewmanagerobject { readonly attribute previewmanager preview; }; webapi implements previewmanagerobject; [nointerfaceobject] interface previewmanager { void setpreviewdata domstring previewdata_json, optional successcallback? successcallback, optional errorcallback? errorcallback ; domstring getversion ; bool setactiondataeventlistener deeplinkcallback deeplinkcallback ; void unactiondataeventlistener ; }; };
Develop Samsung IAP
docsamsung iap purchase acknowledgment api the samsung iap purchase acknowledgment api is used to consume or acknowledge a purchased product before you can start using the iap purchase acknowledgment api, you must meet all requirements, use the required authorization header parameters, and use the required url path paremeters in your requests see get started with the iap apis for more information consume or acknowledge a purchased product after your app has granted entitlement of a product to the user with a successful transaction, your app needs to notify samsung iap that the purchase was successfully processed you can report one or more purchased items as consumed, which makes the items available for another purchase the app user may or may not have used the items or, you can acknowledge that the user has been granted entitlement for one or more purchased subscriptions notewe recommend reporting purchased items immediately after verifying their purchase and reporting all unreported products in one call in order to avoid system overload or malfuction request patch /iap/seller/v6/applications/<packagename>/purchases/<purchaseid> notesee url path parameters for more information about the <packagename> and <purchaseid> parameters body parameter name type description action string requiredthe task to perform must be one of the following consume report one or more purchased items as consumed acknowledge acknowledge that the user has been granted entitlement for one or more purchased subscriptions purchasedidlist[] purchaseid string optionalone or more purchase ids of the purchased item or subscription example single item or subscription request body { "action" "consume" } curl curl -i -x patch \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ -d '{"action" "consume | acknowledge"}' \ 'https //devapi samsungapps com/iap/seller/v6/applications/<packagename>/purchases/<purchaseid>' example multiple items or subscriptions request body { "action" "consume", "purchasedidlist" [ "5fd9b7a353539aaa5401da21d0a3637deee12f2539fcef2f7daba8c9aaa2", "5ed5b555af4ecf4fb756cc32e9cbddd9da15397a26904ff7d1a248eb333d", "698fc6d155e74eee0896ca8a540468883f8db7eee6f3119fb2e298b7abbb" ] } curl curl -i -x patch \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ -d '{"action" "consume | acknowledge", \ "purchasedidlist" [ \ "5fd9b7a353539aaa5401da21d0a3637deee12f2539fcef2f7daba8c9aaa2", \ "5ed5b555af4ecf4fb756cc32e9cbddd9da15397a26904ff7d1a248eb333d", \ "698fc6d155e74eee0896ca8a540468883f8db7eee6f3119fb2e298b7abbb" \ ] }' \ 'https //devapi samsungapps com/iap/seller/v6/applications/<packagename>/purchases/<purchaseid>' response name type description totalcount int the number of products for which a response is returned purchaseitemlist[] purchaseid string the purchase id of the transaction purchaseitemlist[] statuscode string response status code purchaseitemlist[] statusstring string response status message statuscode and statusstring values statuscode statusstring consume statusstring acknowledge 0 success success 1 can't find an order with this purchaseid can't find an order with this purchaseid 2 can't consume this purchase because it's not a successful order this is not a successful order 3 this type of product is not a consumable item this type of product is not a subscription 4 this purchase has been consumed already this purchase has been acknowledged already 5 can't consume this purchase because the user is not authorized to consume this order this purchase is not authorized for this order example response { "totalcount" 3, "purchaseitemlist" [ { "purchaseid" "5fd9b7a353539aaa5401da21d0a3637deee12f2539fcef2f7daba8c9aaa2", "statuscode" "0", "statusstring" "success " }, { "purchaseid" "can't find order with this purchaseid ", "statuscode" "1", "statusstring" "this type of item is not non-consumable or subscription " }, { "purchaseid" "698fc6d155e74eee0896ca8a540468883f8db7eee6f3119fb2e298b7abbb", "statuscode" "3", "statusstring" "this type of item is not non-consumable or subscription " } ] } see failure response codes for a list of possible response codes when a request fails failure response codes status code and message 400bad request 102 invalid parameter 401unauthorized 101 failed to verify gateway server authorization
Develop Health
apioverviewpackageclasstreedeprecatedindex com samsung android sdk healthdata enum healthdataresolver sortorder java lang object java lang enum<healthdataresolver sortorder> com samsung android sdk healthdata healthdataresolver sortorder all implemented interfaces serializable, comparable<healthdataresolver sortorder> enclosing class healthdataresolver public static enum healthdataresolver sortorder extends enum<healthdataresolver sortorder> this enum defines sort orders since 1 0 0 enum constant summary enum constants enum constant and description asc the ascending order desc the descending order method summary all methods static methods concrete methods modifier and type method and description static healthdataresolver sortorder valueof string name returns the enum constant of this type with the specified name static healthdataresolver sortorder[] values returns an array containing the constants of this enum type, in the order they are declared enum constant detail asc public static final healthdataresolver sortorder asc the ascending order desc public static final healthdataresolver sortorder desc the descending order method detail values public static healthdataresolver sortorder[] values returns an array containing the constants of this enum type, in the order they are declared this method may be used to iterate over the constants as follows for healthdataresolver sortorder c healthdataresolver sortorder values system out println c ; returns an array containing the constants of this enum type, in the order they are declared valueof public static healthdataresolver sortorder valueof string name returns the enum constant of this type with the specified name the string must match exactly an identifier used to declare an enum constant in this type extraneous whitespace characters are not permitted parameters name - the name of the enum constant to be returned returns the enum constant with the specified name throws illegalargumentexception - if this enum type has no constant with the specified name nullpointerexception - if the argument is null
We use cookies to improve your experience on our website and to show you relevant advertising. Manage you settings for our cookies below.
These cookies are essential as they enable you to move around the website. This category cannot be disabled.
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.
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.
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.
You have successfully updated your cookie preferences.