Skip to content

Developer notes

Technical reference for developers who customize TikTok Shop Connector.

Item Value
Add-on id kv_tiktok_shop
Function prefix fn_kv_tiktok_shop_
Language variables kv_tiktok_shop.*
CSS scope .kv-tiktok-shop
PHP namespace Tygh\Addons\KvTiktokShop
Preset marketplace (generated by kv new --kind integration)
Class Role
Client\BaseClient HTTP (cURL, TLS verification, timeouts), JSON, error mapping, masked logging
Client\Api TikTok Shop Partner Center API: request signing (HMAC-SHA256 of path + sorted query + body, wrapped in the app secret), authorization code exchange, rotating refresh token under a database lock, per-API versions in the path (202309, 202502, 202507, 202602), business errors in HTTP 200, one thin method per endpoint
Drivers\TikTokShop\Driver, Mapper Hub driver (SKU lookup by seller SKU, create product with image upload, inventory and price, orders, fulfilment, cancel, returns) and the pure translation (unit tested with the official samples in tests/fixtures/)
Client Client per company, the connection test
Accounts, Secret Credentials (test and live) sealed with AES-256-GCM; one account per store owner or per vendor
Config, Access Settings, owner mode, who may see and manage what
Queue, Jobs, JobException Job queue: back-off 5 min / 15 min / 1 h / 3 h / 12 h, per-job isolation, overlap lock; handlers in Jobs::handle(), recurring work in Jobs::schedule()
Log Event log with masking, filters, CSV, retention
Webhook Signature check and event ids; the controller kv_tiktok_shop.webhook?c=<account> stores the event as a job

API conformance (official TikTok Shop Partner Center documentation)

Section titled “API conformance (official TikTok Shop Partner Center documentation)”

Checked on 2026-11-06 against the provider’s own documentation. Read in a browser through the document API behind https://partner.tiktokshop.com/docv2. The API versions below were all present in the public reference (not login gated). Versions are per API; the version is part of the path and of the signed string.

Purpose What the add-on does Official source Verified
Versioning Newest documented versions are used (returns and cancellations 202602, order detail 202507, product search 202500s as below); the account setting “API versions” switches them to 202309, and a “version not supported” answer switches the API to 202309 automatically for the rest of the process https://partner.tiktokshop.com/docv2/page/64f1991064ed2e0295f3cd32 yes
Order list / detail POST /order/202309/orders/search, GET /order/202507/orders?ids= https://partner.tiktokshop.com/docv2/page/650aa8094a0bb702c06df242 ; https://partner.tiktokshop.com/docv2/page/6894134ba28e5204961601a5 yes
Products POST /product/202502/products/search https://partner.tiktokshop.com/docv2/page/67b837b685619104a6846369 yes
Ship package POST /fulfillment/202309/packages/{package_id}/ship https://partner.tiktokshop.com/docv2/page/650aa4f1defece02be6e7cb1 yes
Cancel, cancellations, returns POST /return_refund/202602/cancellations, .../cancellations/search, .../returns/search https://partner.tiktokshop.com/docv2/page/69c30707909b3e049e3d774e ; …/69c3070b793bf0048dbd74e6 ; …/69c3070c441217049711fdea yes
Webhooks Authorization header = HMAC-SHA256(app secret, app key + body) https://partner.tiktokshop.com/docv2/page/6504244ede672602b77f2e41 listed
Table Purpose
?:kv_tiktok_shop_accounts App credentials per company (secrets sealed), last connection check, sealed authorization (tokens + authorized shops)
?:kv_tiktok_shop_log Log
?:kv_tiktok_shop_jobs Queue
?:kv_tiktok_shop_product_map, ?:kv_tiktok_shop_order_map Product mapping and imported orders

PHP hooks: update_product_post, delete_product_post (mark mapped products dirty) and init_templater_post (license UI plugin). Template hooks: addons:manage / tabs_content (license card) and index:styles (admin CSS).

The base URL can be overridden for tests in config.local.php (development only):

$config['kv_tiktok_shop_base_url'] = 'http://127.0.0.1:12877';

node tests/mock-server/server.js 12877 starts a local stand-in of the provider API; node tests/e2e/e2e.mjs runs the HTTP end-to-end test against it; php tests/unit.php runs the unit tests.

Admin templates live in design/backend/templates/addons/kv_tiktok_shop/. Do not edit them in a store; they are replaced on update.