### Get Cold Start Launch Options Source: https://developers.tiktok.com/doc/mini-games-sdk-event?enter_method=left_navigation Synchronously retrieves the parameters used when the Mini Game was initially launched in a session. Returns an object containing the scene and query parameters. ```javascript const launchOptions = TTMinis.game.getLaunchOptionsSync() ``` -------------------------------- ### Install TikTok Minis CLI Source: https://developers.tiktok.com/doc/tiktok-minis-develop-your-mini-app?enter_method=left_navigation Install the command-line interface tool globally to generate config files and debug your mini app. Ensure Node.js and npm are installed. Use the specified registry for installation. ```bash npm install tiktok-minis-cli -g --registry=https://registry.npmjs.org/ ``` -------------------------------- ### .getEnterOptionsSync() Source: https://developers.tiktok.com/doc/mini-games-sdk-event?enter_method=left_navigation Synchronously retrieves the parameters used for any start of the Mini Game, including cold starts and hot starts (returning from the background). Provides consistent entry parameters regardless of the starting state. ```APIDOC ## .getEnterOptionsSync ### Description Get the parameters for opening the mini game, including cold start and warm start. ### Return value ``` interface EnterOptions { scene: string; query: object; } ``` ### Example ```javascript const enterOptions = TTMinis.game.getEnterOptionsSync() ``` ``` -------------------------------- ### User Info Response Example Source: https://developers.tiktok.com/doc/tiktok-api-v1-user-info?enter_method=left_navigation This is an example of a successful response from the user/info/ endpoint, containing basic user data. ```json { "data":{ "user":{ "avatar_url":"https://p19-sign.tiktokcdn-us.com/tos-avt-0068-tx/b17f0e4b3a4f4a50993cf72cda8b88b8~c5_168x168.jpeg", "open_id":"723f24d7-e717-40f8-a2b6-cb8463333b4", "union_id":"c9c60f44-a68e-4f5d-84dd-ce22fddb0ba1" } }, "error":{ "code":0, "message":"" } } ``` -------------------------------- ### Install Pods and Update Repository Source: https://developers.tiktok.com/doc/getting-started-ios-quickstart-swift Run this command in your terminal after updating your Podfile to install the SDK and refresh your local repository. ```bash pod install --repo-update ``` -------------------------------- ### Get Any Enter Options Source: https://developers.tiktok.com/doc/mini-games-sdk-event?enter_method=left_navigation Synchronously retrieves the parameters used for any start of the Mini Game, including cold starts and returns from the background. Provides consistent entry parameters regardless of the starting state. ```javascript const enterOptions = TTMinis.game.getEnterOptionsSync() ``` -------------------------------- ### Initialize Minis Configuration Source: https://developers.tiktok.com/doc/minis-development-stage?enter_method=left_navigation Navigate to your game's build directory and run the 'init' command to set up the minis.config.json file. ```bash cd path/to/your/game/build ttdx minis init ``` -------------------------------- ### Get Subscription Info Response Source: https://developers.tiktok.com/doc/minis-subscription-apis Example response for the get_subscription_info endpoint, detailing a single subscription. ```json { "data": { "subscription": { "subscription_id": "H36qTi1gNU", "tier_id": "iqBaXsMxHh", "is_subscription_rights_valid": true, "is_renewal_normal": false, "trade_order_id": "SbUgvLyKj5", "is_sandbox": true, "begin_time": 7564558100036318910, "end_time": 5659157601114497266, "next_duduct_time": 953443659701638510, "pay_type": "IAP" } }, "error": { "code": "gvlXZLamY7", "message": "2xuw0XIUIr", "log_id": "uPnqDeYu1S" } } ``` -------------------------------- ### Complete minis.config.json Example Source: https://developers.tiktok.com/doc/minis-development-stage?enter_method=left_navigation A comprehensive example of the minis.config.json file, illustrating various configuration options including navbar, dev, build, and domain settings. ```json // minis.config.json { "navbar": { "lightModeBgColor": "#ffffff", "darkModeBgColor": "#000000", }, "dev": { "port": "3000", "host": "localhost" }, "build": { "outputDir": "build", "htmlEntry": "public/index.html" }, "domain": { "allowList": ["https://www.xxx.com"] } } ``` -------------------------------- ### Get Menu Button Layout Info Source: https://developers.tiktok.com/doc/mini-games-sdk-ui?enter_method=left_navigation Use this to get the layout position of the menu button. Coordinate information starts from the upper left corner of the screen. This API is only required for games that use HTML runtime. ```javascript const res = TTMinis.game.getMenuButtonBoundingClientRect() console.log(res.width) console.log(res.height) console.log(res.top) console.log(res.right) console.log(res.bottom) console.log(res.left) ``` -------------------------------- ### Start Debugging Environment Source: https://developers.tiktok.com/doc/debug-your-mini-game Initiate the local debugging environment for your mini-game. Your app's client key will be requested on the first session and stored for future use. ```bash ttmg dev ``` -------------------------------- ### .getLaunchOptionsSync() Source: https://developers.tiktok.com/doc/mini-games-sdk-event?enter_method=left_navigation Synchronously retrieves the parameters used when the Mini Game was cold-started (opened for the first time in the session). Returns an object containing the scene and query parameters. ```APIDOC ## .getLaunchOptionsSync ### Description Get the parameters during the cold start of the mini game. ### Return value ``` interface LaunchOptions { scene: string; query: object; } ``` ### Example ```javascript const launchOptions = TTMinis.game.getLaunchOptionsSync() ``` ``` -------------------------------- ### Get Active Subscriptions Response Source: https://developers.tiktok.com/doc/minis-subscription-apis Example response structure for the get_active_list endpoint, showing details of user subscriptions. ```json { "data": { "subscriptions": [ { "subscription_id": "tb4ML0ZVim", "tier_id": "xohs4Jojay", "is_subscription_rights_valid": true, "is_renewal_normal": false, "trade_order_id": "ggG7luEdWt", "is_sandbox": true, "begin_time": 8054018414209391465, "end_time": 1061662930613089341, "next_duduct_time": 2184276991229817160, "pay_type": "IAP" } ] }, "error": { "code": "ok", "message": "", "log_id": "20241125114034036EE8AEADBAF91D5E93" } } ``` -------------------------------- ### Get Ad Report Request Example Source: https://developers.tiktok.com/doc/commercial-content-api-get-ad-report?enter_method=left_navigation This cURL command demonstrates how to make a POST request to the Get Ad Report API, including necessary headers and a JSON body with filters for the ad publication date range and advertiser business IDs. ```curl curl -L -X POST 'https://open.tiktokapis.com/v2/research/adlib/ad/report/?fields=count_time_series_by_country' \ -H 'Authorization: Bearer clt.example12345Example12345Example' \ -H 'Content-Type: application/json' \ --data-raw '{ "filters":{ "ad_published_date_range": { "min": "20230102", "max": "20230109" }, "country_code":"ALL", "advertiser_business_ids":[21836478203048,3484763562784] } }' ``` -------------------------------- ### Configure minis.config.json build settings Source: https://developers.tiktok.com/doc/debug-your-mini-app?enter_method=left_navigation Example configuration for `minis.config.json` specifying build output directory and HTML entry point. ```json { "dev": { "port": 3000, "host": "localhost" }, "build": { "outputDir": "dist", "htmlEntry": "public/index.html" } } ``` -------------------------------- ### Get Trade Order Info Response Source: https://developers.tiktok.com/doc/minis-subscription-apis Example response for the get_trade_order_info endpoint, providing details about a trade order's status and associated subscription. ```json { "data": { "trade_order_id": "UIlpZZ1TIc", "subscription_id": "iSjgkQ9rei", "trade_order_status": "BRM1MQac3i", "is_sandbox": true, "begin_time": 162780036655460135, "end_time": 7326223299323173385, "actually_end_time": 7143902738493296646, "pay_type": "IAP" }, "error": { "code": "ok", "message": "", "log_id": "20241125114034036EE8AEADBAF91D5E93" } } ``` -------------------------------- ### Start Local Development Server Source: https://developers.tiktok.com/doc/home-screen-shortcut Navigate to your game's directory and run `ttmg dev` to launch the debugging environment for your mini game. ```bash cd path/to/your/game ttmg dev ``` -------------------------------- ### Revisit from Profile Source: https://developers.tiktok.com/doc/develop-your-mini-game?enter_method=left_navigation Encourages users to revisit the game by guiding them to the TikTok profile sidebar. Includes checking availability, starting the mission, and claiming the reward. ```APIDOC ## Revisit from Profile This process encourages users to revisit the game by guiding them to the TikTok profile sidebar, where the mini game is featured. ### Check Availability Before calling the API, check if the function is available in the current TikTok version with `canIUse`. ```javascript if (TTMinis.game.canIUse("startEntranceMission")) { // Proceed to call the API } ``` ### Start Entrance Mission Execute the `startEntranceMission` function. This navigates the user to the TikTok profile sidebar, effectively completing the follow-up education task. ```javascript TTMinis.game.startEntranceMission({ success: () => { // Log or handle the successful navigation to the sidebar console.log("Successfully jumped to the sidebar of the home page"); }, fail: () => { // Handle failure to jump }, complete: () => { // Cleanup or final actions } }); ``` ### Get Entrance Mission Reward After the user has completed the entrance/sidebar mission (usually by visiting the sidebar via Step 1), the game can award them. 1. Check reward status: Call the `getEntranceMissionReward` API. This checks the user's eligibility for the reward associated with the sidebar revisit mission. 2. Handle success: Check the `canReceiveReward` boolean in the success callback. ```javascript TTMinis.game.getEntranceMissionReward({ success: ({ canReceiveReward }) => { if (canReceiveReward) { // If true, grant the reward (coins, items, etc.) in your game logic console.log("User is eligible for the entrance mission reward"); } else { console.log("User is not currently eligible for the reward"); } }, fail: () => { // Handle failure to check status }, complete: () => { // Cleanup or final actions } }); ``` ``` -------------------------------- ### Initialize SDK with Client Key Source: https://developers.tiktok.com/doc/mini-games-sdk-get-started Use the `TTMinis.game.init()` method to initialize the SDK. This must be called before any other SDK methods. Replace `{app-client-key}` with your actual client key. ```javascript TTMinis.game.init({ clientKey: '{app-client-key}' }); ``` -------------------------------- ### Initialize SDK Source: https://developers.tiktok.com/doc/mini-games-sdk-get-started?enter_method=left_navigation Include this code snippet directly after the opening `
` tag on each page where you want to load the basic version of the SDK with default options. Replace `{app-client-key}` with your app's client key. ```APIDOC ## Initialize SDK ### Description This section details how to initialize the Mini Games SDK for your HTML mini game. ### Method `TTMinis.game.init(params)` ### Parameters #### Request Body - **params** (Object) - Required - Initialization parameters. - **clientKey** (string) - Required - Your app's client key obtained from the Developer Portal. ``` -------------------------------- ### Register Redirect URI Example Source: https://developers.tiktok.com/bulletin/migration-guidance-oauth-v1 Ensure your redirect URIs are absolute, start with https, are static, and do not contain fragments. URIs must be less than 512 characters. ```text https://dev.example.com/auth/callback/ ``` -------------------------------- ### Example Opening Time Data Structure Source: https://developers.tiktok.com/doc/shop-management?enter_method=left_navigation This example demonstrates the structure for providing shop opening hours, including the day of the week and time periods. ```json [ { "day": 1, "time_periods": [ { "start_time": "04:00", "end_time": "07:00" } ] }, { "day": 4, "time_periods": [ { "start_time": "04:00", "end_time": "07:00" } ] } ] ``` -------------------------------- ### Get Android App Signature Source: https://developers.tiktok.com/doc/login-kit-android?enter_method=left_navigation Obtain the MD5 hex digest of your installed release app's signature. This is required for app registration on the Developer Portal. ```java PackageManager manager = getPackageManager(); /** Get the package information of the specified package name including the signature through the package manager **/ PackageInfo packageInfo = null; try { packageInfo = manager.getPackageInfo("your package name", PackageManager.GET_SIGNATURES); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } /** Get the signature array through the returned package information **/ Signature[] signatures = packageInfo.signatures; String ss = MD5.hexdigest(signatures[0].toByteArray()); if(ss != null) { Toast.makeText(this, "signature" + ss, Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, "No signature", Toast.LENGTH_LONG).show(); } /** Create an MD5 tool class **/ public class MD5 { private static final char[] hexDigits = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102 }; public static String hexdigest(String paramString) { try { String str = hexdigest(paramString.getBytes()); return str; } catch (Exception localException) { } return null; } public static String hexdigest(byte[] paramArrayOfByte) { try { MessageDigest localMessageDigest = MessageDigest.getInstance("MD5"); localMessageDigest.update(paramArrayOfByte); byte[] arrayOfByte = localMessageDigest.digest(); char[] arrayOfChar = new char[32]; int i = 0; int j = 0; while (true) { if (i >= 16) return new String(arrayOfChar); int k = arrayOfByte[i]; int m = j + 1; arrayOfChar[j] = hexDigits[(0xF & k >>> 4)]; j = m + 1; arrayOfChar[m] = hexDigits[(k & 0xF)]; i++; } } catch (Exception localException) { } return null; } } ``` -------------------------------- ### Get User Info Request Example Source: https://developers.tiktok.com/doc/tiktok-api-v1-user-info?enter_method=left_navigation Use this cURL command to make a POST request to the user/info/ endpoint. Ensure you include your access token and specify the desired fields. ```curl curl -L -X POST 'https://open-api.tiktok.com/user/info/' \ -H 'Content-Type: application/json' \ --data-raw '{ \ "access_token": "act.example12345Example12345Example", \ "fields": ["open_id", "union_id", "avatar_url"] \ }' ``` -------------------------------- ### Initialize Mini Games SDK Source: https://developers.tiktok.com/doc/mini-games-sdk-get-started Include this script directly after the opening `` tag to load the basic version of the SDK with default options. Replace `{app-client-key}` with your app's client key. ```html ``` -------------------------------- ### Initialize Mini Game Configuration Source: https://developers.tiktok.com/doc/mini-games-development-stage Run the 'init' command within your game's build directory to set up the minigame.config.json file and inject SDK initialization code. ```bash cd path/to/your/game/build ttmg init --h5 ``` -------------------------------- ### .init(params) Source: https://developers.tiktok.com/doc/mini-games-sdk-get-started The `TTMinis.game.init()` method is used to initialize and set up the SDK. All other SDK methods must be called after this one. ```APIDOC ## .init(params) The method `TTMinis.game.init()` is used to initialize and set up the SDK. All other SDK methods must be called after this one, because they won't exist until you do. ### Parameters ```javascript /** * Init JSSDK * @param {Object} params - Init params * @param {string} params.clientKey - clientKey from https://developers.tiktok.com/apps/ */ TTMinis.game.init(params) ``` ### Example ```javascript TTMinis.game.init({ clientKey: '{app-client-key}' }); ``` ``` -------------------------------- ### Get Storage Information (Async) Source: https://developers.tiktok.com/doc/mini-games-sdk-storage?enter_method=left_navigation Asynchronously retrieves information about the current storage, including all keys, current size, and limit size. This API is supported starting from SDK version 0.8.0. ```javascript TTMinis.game.getStorageInfo({ ``` -------------------------------- ### Initiate Payment with Minis SDK Source: https://developers.tiktok.com/doc/minis-sdk-payment Example of how to initiate a payment using the Minis.pay function. It includes a callback to handle the payment result and an options object with the trade order ID. ```javascript Minis.pay((result)=>{ if(result.is_success){ // do something } else { // do something } },{trade_order_id: "demo"}) ``` -------------------------------- ### Get User Info Request Example (cURL) Source: https://developers.tiktok.com/doc/tiktok-api-v1-user-info Use this cURL command to make a POST request to the user/info/ endpoint. Ensure you include the correct access token and specify the desired fields. ```bash curl -L -X POST 'https://open-api.tiktok.com/user/info/' \ -H 'Content-Type: application/json' \ --data-raw '{ "access_token": "act.example12345Example12345Example", "fields": ["open_id", "union_id", "avatar_url"] }' ``` -------------------------------- ### Get Recharge Tiers Response Source: https://developers.tiktok.com/doc/minis-payment-apis?enter_method=left_navigation This is an example of a successful response when fetching recharge tier information. It includes details like tier ID, name, token amount, price, currency, and symbol. ```json { "data": { "tier_infos": { "1731381720000100": { "tier_id": "1731381720000100", "tier_name": "pd_beans_showcase_100", "token_amount": 100, "token_type": "BEANS", "price": "1.19", "currency": "USD", "symbol": "$" } } }, "error": { "code": "ok", "message": "", "log_od": "202411190743174589DAA30620D104990F" } } ``` -------------------------------- ### Load and Initialize TikTok Minis SDK Source: https://developers.tiktok.com/doc/minis-sdk-get-started Include this script in your HTML after the opening `` tag to load the SDK with default options. Replace `{app-client-key}` with your actual client key. ```html ``` -------------------------------- ### Ad Report Response Example Source: https://developers.tiktok.com/doc/commercial-content-api-get-ad-report?enter_method=left_navigation This JSON object shows a typical response from the Get Ad Report API, including the ad count time series by country and error details if applicable. ```json { "data": { "count_time_series_by_country": { "IT": [{"date": "20210109", "count": 45}, {"date": "20210108", "count": 24}], "ES": [{"date": "20210109", "count": 48}, {"date": "20210108", "count": 22}], ... } }, "error": { "code": "ok", "http_status_code": 200, "log_id": "202207280326050102231031430C7E754E", "message": "" } } ``` -------------------------------- ### Initiate Video Post (File Upload) Source: https://developers.tiktok.com/doc/content-posting-api-get-started?enter_method=left_navigation This example shows how to initiate a video post when uploading a video file directly. It returns an upload URL and a publish ID. ```APIDOC ## POST /v2/post/publish/video/init/ ### Description Initiates the video posting process for file uploads. Returns an upload URL and a publish ID. ### Method POST ### Endpoint https://open.tiktokapis.com/v2/post/publish/video/init/ ### Request Body - **post_info** (object) - Required - Information about the post, including title, privacy, and comment/duet/stitch settings. - **title** (string) - Required - The title of the video. - **privacy_level** (string) - Required - The privacy level of the video (e.g., "MUTUAL_FOLLOW_FRIENDS", "PUBLIC_TO_EVERYONE"). - **disable_duet** (boolean) - Optional - Whether to disable duets. - **disable_comment** (boolean) - Optional - Whether to disable comments. - **disable_stitch** (boolean) - Optional - Whether to disable stitches. - **video_cover_timestamp_ms** (integer) - Optional - The timestamp in milliseconds to use for the video cover. - **source_info** (object) - Required - Information about the video source. - **source** (string) - Required - The source of the video, must be "FILE_UPLOAD". - **video_size** (integer) - Required - The total size of the video file in bytes. - **chunk_size** (integer) - Required - The size of each chunk for uploading. - **total_chunk_count** (integer) - Required - The total number of chunks for the video. ### Request Example ```json { "post_info": { "title": "this will be a funny #cat video on your @tiktok #fyp", "privacy_level": "MUTUAL_FOLLOW_FRIENDS", "disable_duet": false, "disable_comment": true, "disable_stitch": false, "video_cover_timestamp_ms": 1000 }, "source_info": { "source": "FILE_UPLOAD", "video_size": 50000123, "chunk_size": 10000000, "total_chunk_count": 5 } } ``` ### Response #### Success Response (200) - **data** (object) - Contains data related to the post initiation. - **publish_id** (string) - The unique identifier for the publish operation. - **upload_url** (string) - The URL to upload the video file to. - **error** (object) - Error details if any occurred. - **code** (string) - Error code. - **message** (string) - Error message. - **log_id** (string) - Log ID for tracking. #### Response Example ```json { "data": { "publish_id": "v_pub_file~v2-1.123456789", "upload_url": "https://open-upload.tiktokapis.com/video/?upload_id=67890&upload_token=Xza123" }, "error": { "code": "ok", "message": "", "log_id": "202210112248442CB9319E1FB30C1073F3" } } ``` ``` -------------------------------- ### Get Ad Details using cURL Source: https://developers.tiktok.com/doc/commercial-content-api-get-ad-details?enter_method=left_navigation This example demonstrates how to retrieve ad details using a cURL command. Ensure you include the necessary Authorization and Content-Type headers, and specify the desired fields in the query parameters. ```curl curl -L -X POST 'https://open.tiktokapis.com/v2/research/adlib/ad/detail/?fields=ad.id,ad.first_shown_date,ad.last_shown_date' \ -H 'Authorization: Bearer clt.example12345Example12345Example' \ -H 'Content-Type: application/json' \ --data-raw '{ "ad_id": 104836593772645 }' ``` -------------------------------- ### Get Storage Information (Sync) Source: https://developers.tiktok.com/doc/mini-games-sdk-storage?enter_method=left_navigation Synchronously retrieves information about the current storage, including all keys, current size, and limit size. This API is supported starting from SDK version 0.8.0. Ensure to handle potential exceptions. ```javascript try { const res = TTMinis.game.getStorageInfoSync() console.log(res.keys) console.log(res.currentSize) console.log(res.limitSize) } catch (e) { ``` -------------------------------- ### Start Debugging Session Source: https://developers.tiktok.com/doc/debug-your-mini-app?enter_method=left_navigation Run the 'minis dev' command in your project root to start the local development server and initiate a debugging session. ```bash minis dev ``` -------------------------------- ### Get Subscription Tier Info Response Source: https://developers.tiktok.com/doc/minis-subscription-apis This is an example of a successful response when querying subscription tier information. The `data` object contains `subscription_tiers_info`, a map where keys are internal identifiers and values provide details like `tier_id`, `deduct_cycle`, `deduct_type`, `price`, `currency`, and `symbol`. ```json { "data": { "subscription_tiers_info": { "zqrPo2cIEE": { "tier_id": "IdohVeNqMX", "deduct_cycle": "I6Sj9ICBaW", "deduct_type": "CfuHfLeMoH", "price": "MrofV8f93l", "currency": "QiWeEc4YoU", "symbol": "uPk6QRdtsv" } } }, "error": { "code": "ok", "message": "", "log_id": "20241125114034036EE8AEADBAF91D5E93" } } ``` -------------------------------- ### Save Product using Golang Source: https://developers.tiktok.com/doc/dining-saas-sample-code This Golang example demonstrates how to make a POST request to the Save Product API. Remember to replace placeholders like {MERCHANT_ID} and {ACCESS_TOKEN} with your specific credentials. ```Golang package main import ( "bytes" "fmt" "io/ioutil" "net/http" ) func main() { apiURL := "https://open.tiktokapis.com/v2/localservice/saas/product/save/" jsonBody := []byte(`{ "merchant_id": "{MERCHANT_ID}", "third_product_id": "{THIRD_PRODUCT_ID}", "category_id": "722511", "product_type": 2, "attr_key_value_map": { "rec_person_num": "\"1\"", "shop_id": "[\"{SHOP_ID}\"]", "commodity_set": "2", "commodity": "[{\"i18n_group_mame\":{\"default_text\":\"Pizza Group\"},\"total_count\":1,\"option_count\":1,\"item_list\":[{\"i18n_name\":{\"default_text\":\"Large Pizza\"},\"price\":\"100000\",\"currency\":\"Rp\",\"count\":1}]}]", "product_name": "{\"default_text\":\"Pizza Voucher\"}", "image_list": "[{\"outer_url\":\"https://example.com/pizza.jpg\"}]", "origin_amount": "150000", "actual_amount": "100000", "local_currency": "Rp", "stock_info": "{\"stock_num\":100,\"stock_qty_limit_type\":1}", "sold_time_type": 2, "use_type": 1, "use_date": "{\"use_date_type\":2,\"day_duration\":30}", "use_time": "{\"use_time_type\":1}", "consumption_convention": "{\"consumption_method\":3}" } }`) req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonBody)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Set("Authorization", "Bearer {ACCESS_TOKEN}") req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println("Status Code:", resp.StatusCode) fmt.Println("Response Body:", string(body)) } ``` -------------------------------- ### Example Usage of createSubscription Source: https://developers.tiktok.com/doc/minis-sdk-subscriptions Demonstrates how to call the `createSubscription` API with a callback and options, including checking the success status of the operation. ```javascript TTMinis.createSubscription((result) => { if(result?.is_success) { // do something } else { // do something } }, { trade_order_id: 'your-trade-order-id', }) ```