Developer notes
Technical reference for developers who customize Trendyol Marketplace Connector.
Add-on identity
Section titled “Add-on identity”| Item | Value |
|---|---|
| Add-on id | kv_trendyol |
| Function prefix | fn_kv_trendyol_ |
| Language variables | kv_trendyol.* |
| CSS scope | .kv-trendyol |
| PHP namespace | Tygh\Addons\KvTrendyol |
| Preset | marketplace (generated by kv new --kind integration), extended with the Marketplace Hub |
Structure
Section titled “Structure”The add-on has three layers. Only the last one knows Trendyol.
| Layer | Classes | Role |
|---|---|---|
| Base | Client\BaseClient, Accounts, Secret, Config, Access, Queue, Jobs, Log, Webhook |
HTTP (cURL, TLS verification, timeouts), encrypted credentials per company, settings, job queue (back-off 5 min / 15 min / 1 h / 3 h / 12 h), log with masking and CSV |
Marketplace Hub (Hub\) |
DriverInterface, Hub, Options, Rules, StatusMap, Cache, Categories, Listings, ProductMap, ProductSync, Orders, Shipments, Returns |
Channel independent: category and attribute mapping, price rules and stock buffer, listing builder, product and batch sync, order import with buyer and address mapping, status mapping, shipment steps, returns, per item errors. It talks to the channel only through DriverInterface with normalized arrays (documented in the interface file) |
Driver (Drivers\Trendyol\, Client\Api) |
Driver, Mapper, Api |
Api = HTTP calls (Basic auth, User-Agent, endpoints), Mapper = pure translation (unit tested with samples), Driver = the DriverInterface implementation. Hub\Hub::DRIVER names it |
A second channel (Hepsiburada, N11 …) is a new add-on built from the same hub with its own Api, Mapper and Driver.
API conformance (official Trendyol documentation)
Section titled “API conformance (official Trendyol documentation)”Every call the add-on makes was checked on 2026-11-06 against the official documentation at developers.trendyol.com (index:
https://developers.trendyol.com/llms.txt). The pages used are copied verbatim in tests/mock-server/docs/; tests/mock-server/build-fixtures.py
turns their example requests and responses into tests/mock-server/fixtures/*.json, and the mock server, the unit tests and the e2e test
use those fixtures. A path, method or field that differs from the documentation therefore fails the tests.
| Purpose | Method and path (base https://apigw.trendyol.com, test mode https://stageapigw.trendyol.com) |
Body / fields used | Official page | Verified |
|---|---|---|---|---|
| Authentication | every call: Authorization: Basic apiKey:apiSecret, User-Agent: <sellerId> - <integrator> (alphanumeric, max 30) or <sellerId> - SelfIntegration |
401 ClientApiAuthenticationException, 403 without User-Agent |
https://developers.trendyol.com/docs/2-authorization.md | yes |
| Live and test hosts | apigw.trendyol.com, stageapigw.trendyol.com (test needs an IP allow-list at Trendyol) |
https://developers.trendyol.com/docs/3-canlı-test-ortam-bilgileri.md | yes | |
| Rate limit | 50 requests per 10 s per endpoint, 429 retried by the queue | https://developers.trendyol.com/docs/1-servis-limitleri.md | yes | |
| Connection test | GET /integration/product/sellers/{sellerId}/products/approved?page=0&size=1 |
totalElements |
https://developers.trendyol.com/docs/ürün-filtreleme-onaylı-ürün-v2.md | yes |
| Category tree | GET /integration/product/product-categories |
id, name, parentId, subCategories |
https://developers.trendyol.com/docs/trendyol-kategori-listesi-getcategorytree-1.md | yes |
| Category attributes (v2) | GET /integration/product/categories/{categoryId}/attributes |
categoryAttributes[].attribute.{id,name}, required, allowCustom, allowMultipleAttributeValues |
https://developers.trendyol.com/docs/kategori-özellik-listesi-v2.md | yes |
| Attribute values (v2) | GET /integration/product/categories/{categoryId}/attributes/{attributeId}/values?page&size=1000 |
content[].attributeValueId, content[].attributeValue |
https://developers.trendyol.com/docs/kategori-özellik-değerleri-listesi-v2.md | fixed in 1.0.1 (read attributeValue) |
| Brand search | GET /integration/product/brands/by-name?name= (case sensitive) |
[{id, name}] |
https://developers.trendyol.com/docs/trendyol-marka-listesi-getbrands-1.md | yes |
| Create products (v2) | POST /integration/product/sellers/{sellerId}/v2/products |
items[] (max 1000) with the documented fields; attributes {attributeId, attributeValueId}, {attributeId, attributeValueIds} (multi-value attributes), {attributeId, customAttributeValue}; returns batchRequestId |
https://developers.trendyol.com/docs/ürün-yaratma-v2.md | fixed in 1.0.1 (attribute shapes) |
| Stock and price | POST /integration/inventory/sellers/{sellerId}/products/price-and-inventory |
items[] {barcode, quantity, salePrice, listPrice} (max 1000, listPrice >= salePrice, max stock 20000) |
https://developers.trendyol.com/docs/stok-ve-fiyat-güncelleme-updatepriceandinventory-1.md | yes |
| Batch result | GET /integration/product/sellers/{sellerId}/products/batch-requests/{batchRequestId} |
product batches: status IN_PROGRESS / COMPLETED; stock and price batches: no batch status, item status SUCCESS / FAILED, failureReasons |
https://developers.trendyol.com/docs/toplu-i̇şlem-kontrolü-getbatchrequestresult-1.md | fixed in 1.0.1 (stock/price batches) |
| Orders (shipment packages) | GET /integration/order/sellers/{sellerId}/v2/orders?startDate&endDate&page&size=200&orderByField=PackageLastModifiedDate&orderByDirection=ASC |
max 2 weeks per window, pages 0-49; the unversioned /orders path is retired since 15 Oct 2026 |
https://developers.trendyol.com/docs/sipariş-paketlerini-çekme-getshipmentpackages.md | yes |
| Picking / Invoiced | PUT /integration/order/sellers/{sellerId}/shipment-packages/{packageId} |
{lines: [{lineId, quantity}], params: {} or {invoiceNumber}, status: "Picking" or "Invoiced"} |
https://developers.trendyol.com/docs/paket-statü-bildirimi-updatepackage.md | fixed in 1.0.1 (lines, params) |
| Cannot supply | PUT /integration/order/sellers/{sellerId}/shipment-packages/{packageId}/items/unsupplied |
{lines: [{lineId, quantity}], reasonId: 500, 501, 502, 504, 505 or 506} |
https://developers.trendyol.com/docs/tedarik-edememe-bildirimi-updatepackage.md | yes |
| Own carrier tracking | PUT /integration/order/sellers/{sellerId}/shipment-packages/{packageId}/alternative-delivery |
{isPhoneNumber: false, trackingInfo: <tracking link>, params: {}} |
https://developers.trendyol.com/docs/alternatif-teslimat-i̇le-gönderim.md | yes |
| Returns | GET /integration/order/sellers/{sellerId}/claims?startDate&endDate&page&size |
content[].id, orderNumber, claimDate, items[].orderLine, items[].claimItems[].{id, claimItemStatus.name, customerClaimItemReason.name, customerNote} |
https://developers.trendyol.com/docs/i̇adesi-oluşturulan-siparişleri-çekme-getclaims.md | yes |
| Approve return items | PUT /integration/order/sellers/{sellerId}/claims/{claimId}/items/approve |
{claimLineItemIdList: [...], params: {}} (WaitingInAction items only) |
https://developers.trendyol.com/docs/i̇ade-siparişleri-onaylama-approveclaimlineitems.md | yes |
| Cargo providers | GET /integration/product/lookup/cargo-providers |
[{code, name}] |
https://developers.trendyol.com/docs/kargo-firması-filtreleme-servisi.md | yes |
| Register webhook | POST /integration/webhook/sellers/{sellerId}/webhooks |
{url, authenticationType: "API_KEY", apiKey}; returns {id}; the URL must not contain “Trendyol”, “Dolap” or “Localhost” |
https://developers.trendyol.com/docs/webhook-yaratma.md | fixed in 1.0.1 (neutral address) |
| Incoming webhook | POST from Trendyol to the shop, header x-api-key |
the getShipmentPackages page model: {totalElements, totalPages, page, size, content: [package]}; idempotency on shipmentPackageId + shipmentPackageStatus + lastModifiedDate (at-least-once delivery, resend every 5 minutes) |
https://developers.trendyol.com/docs/webhook-model.md | fixed in 1.0.1 (content[]) |
Webhook address registered at Trendyol: index.php?dispatch=kv_tyhook.webhook&c=<account> (a neutral alias of kv_trendyol.webhook, which keeps working for addresses registered with 1.0.0).
Database tables
Section titled “Database tables”| Table | Purpose |
|---|---|
?:kv_trendyol_accounts |
Credentials per company (secrets sealed), last connection check |
?:kv_trendyol_log, ?:kv_trendyol_jobs |
Log, queue |
?:kv_trendyol_product_map |
Product mapping: barcode, listing state (N / P / Y), dirty flags, last pushed values, error |
?:kv_trendyol_order_map |
Imported orders, channel status, steps pushed, import error and retry time |
?:kv_trendyol_options |
Rules per account |
?:kv_trendyol_category_map, ?:kv_trendyol_attr_map |
Category mapping with price rule, attribute mapping |
?:kv_trendyol_cache |
Cached reference data (categories, attributes, values, brands) |
?:kv_trendyol_batches |
Asynchronous batch requests waiting for their per item result |
?:kv_trendyol_returns |
Claims |
Hooks used
Section titled “Hooks used”PHP hooks: update_product_post (marks the mapped product for the next sync) and delete_product_post (removes its mapping). Template hooks: index:styles (admin styles). The pages come from the add-on’s own controller (kv_trendyol) and the menu schema.
Test the HTTP layer without Trendyol
Section titled “Test the HTTP layer without Trendyol”The base URL can be overridden for tests in config.local.php (development only):
$config['kv_trendyol_base_url'] = 'http://127.0.0.1:11830';tests/mock-server/server.js answers with the documentation examples (tests/mock-server/fixtures) and checks request bodies against the documented shapes (Basic auth, User-Agent rule, v2 paths, updatePackage lines, v2 attribute shapes, batches with and without a batch status, the webhook model); tests/unit.php asserts the documented paths and bodies with the same fixtures; tests/e2e/e2e.mjs drives a whole store against the mock.