Shops and Cart Drafts
Partners maintain their bound shops and run the "submit for pricing → staff review → place order" flow through cart drafts. Identity always comes from the token-resolved member, and the shop scope comes from ChannelPartnerShop bindings; a client-supplied member_id is never trusted.
Authentication and Conventions
Every /channel/api/v1/* endpoint is guarded by ChannelPartnerAuthMiddleware: send either request-token or Authorization: Bearer <token> (user session token or developer secret).
| Header | Required | Description |
|---|---|---|
request-token | one of two | Channel partner app token |
Authorization | one of two | Bearer <token>, user session token or developer secret |
Content-Type | yes | application/json |
Required capability: none. shop/* and shop/cart-draft/* paths are not in the capability map, so a valid channel partner identity is enough (see app/channel/middleware/ChannelPartnerAuthMiddleware.php:39-46).
Common error codes:
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Parameter or business validation failure |
| 404 | Resource not found or outside the partner scope |
| 500 | Server error |
Bound Shops
/channel/api/v1/shop/boundAuth: request-token (channel_partner)
Return the shops (authorize) bound to the current partner, exposing only id, name, and brief; secrets and other sensitive fields are never returned.
Required capability: none
Request Body
None.
Response
{
"code": 200,
"msg": "shop bound succeed",
"data": [
{ "id": 21, "name": "Partner Shop DE", "brief": "Germany distribution" }
]
}| Field | Type | Description |
|---|---|---|
id | integer | Shop (authorize) ID, used as shop_id in /shop/product/attach and shop/product/list |
name | string | Shop name |
brief | string | Short description, may be empty |
Note: when no shop is bound the endpoint returns an empty array while msg stays shop bound succeed.
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 500 | Server error |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/bound' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json'Available Grants
/channel/api/v1/shop/grantsAuth: request-token (channel_partner)
Return the authorization grants usable for creating a shop (hottol grants). Results are filtered locally by systemGroup.code = shop, kept only when enabled, and deduplicated by id. The upstream call is fixed to pageSize = 200; only the first 200 rows are read and any excess is silently truncated.
Required capability: none
Request Body
None.
Response
{
"code": 200,
"msg": "success",
"data": [
{
"id": 12,
"grant_id": 12,
"name": "Shop connector",
"code": "shop_connector",
"oauth": false
}
]
}| Field | Type | Description |
|---|---|---|
id / grant_id | integer | Grant definition ID (both identical). grant_id is used by shop/grant-fields; id can be sent as authorization to shop/create |
name / code | string | Grant name / code |
oauth | boolean | Whether the grant uses OAuth |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Grant API call failed (failed to fetch grants) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/grants' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json'Grant Fields
/channel/api/v1/shop/grant-fieldsAuth: request-token (channel_partner)
Return the field definitions of one grant (sense = authorize) for dynamic shop-creation forms. Only the fields the portal needs are returned; the grant object containing secrets is never passed through.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
grant_id | integer | yes | Grant definition ID from grant_id in shop/grants |
Response
{
"code": 200,
"msg": "success",
"data": [
{
"id": 301,
"name": "API Key",
"field": "api_key",
"placeHolder": "Enter API key",
"help": "Provided by the shop platform",
"min": 0,
"max": 0,
"minLength": 8,
"maxLength": 64,
"required": true,
"formType": "text",
"rows": 6,
"fixValue": "",
"options": []
}
]
}| Field | Type | Description |
|---|---|---|
id | integer | Field definition ID |
name / field | string | Display name / submitted field name |
placeHolder / help | string | Placeholder / help text |
min / max | integer | Numeric range |
minLength / maxLength | integer | Text length range |
required | boolean | Whether the field is required |
formType | string | Form type, e.g. text / radio / select / checkbox / multiselect |
rows | integer | Textarea rows, default 6 |
fixValue | string | Fixed value; empty when options are present |
options[].key / value | string | Option label / submitted value; options with state = false are dropped |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Missing grant_id (grant_id is required), or the field API call failed (failed to fetch grant fields) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/grant-fields' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"grant_id": 12
}'Create Shop
/channel/api/v1/shop/createAuth: request-token (channel_partner)
Self-service shop creation: insert an authorize row and bind it to the current member in one transaction, so the shop appears immediately in the bound list. The shop type is derived from the grant's systemGroup.code; a client-supplied type is never accepted.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Shop name |
brief | string | yes | Shop description |
authorization | integer | yes | Grant definition ID (hottol grant id) |
property | object | no | Dynamic form values matching shop/grant-fields; stored in authorize.meta.property |
Response
{
"code": 200,
"msg": "shop create succeed",
"data": { "id": 22, "shop_id": 22 }
}| Field | Type | Description |
|---|---|---|
id / shop_id | integer | New shop (authorize) ID, both identical |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Missing name / brief / authorization; a shop with the same name and authorization exists (the some name of item is exist); grant missing (the authorization grant is not exist); same name and authorization as the primary shop (the primary shop cannot be created); transaction errors return the exception message |
| 500 | Grant lookup failed (getGrants runs outside the transaction try block and is not caught) |
Note: binding is idempotent and skipped when it already exists; the duplicate (name, authorization) check is global rather than per-member; the primary-shop guard checks both authorization and name, so reusing the same authorization under a different name is allowed.
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/create' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Partner Shop FR",
"brief": "France distribution",
"authorization": 12,
"property": {
"api_key": "YOUR_SHOP_KEY"
}
}'Attach Products
/channel/api/v1/shop/product/attachAuth: request-token (channel_partner)
Attach (copy) primary-shop products into one of the partner's own shops. Each master product becomes an independent t_item + t_variants snapshot; a repeat attach only refreshes descriptive/logistics columns and never overwrites shop-owned prices.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
shop_id | integer | yes | Target shop ID; must be bound to the current partner and must not be the primary shop |
item_ids | array | yes | Primary-shop product IDs; 1–50 after deduplication; non-numeric or non-positive values are ignored |
Note: attach copies descriptive fields, images, logistics, and classification, and writes an attach-time price snapshot; cost / cost_price / shop_sku_id are never copied. Repeat attaches identify an item by (shop_id, shop_sku) and a variant by (product_id, shop_sku), refreshing only descriptive/logistics columns. A skipped product does not abort the batch; an unexpected error rolls back the whole batch.
Response
{
"code": 200,
"msg": "attach succeed",
"data": {
"shop_id": 21,
"attached": 1,
"items": [
{
"master_item_id": 501,
"item_id": 1501,
"shop_sku": "E2C-BAT-100",
"action": "created",
"variant_count": 1
}
]
}
}| Field | Type | Description |
|---|---|---|
shop_id | integer | Target shop ID |
attached | integer | Number of products attached (item_id not null) |
items[].master_item_id | integer | Primary-shop product ID |
items[].item_id | integer | null | Shop-side product ID; null when skipped |
items[].shop_sku | string | Shop-side SKU; empty when skipped |
items[].action | string | created / updated / skipped |
items[].variant_count | integer | Variants created or refreshed; 0 when skipped |
items[].reason | string | Present only when skipped: product not found in the master catalog / product has no variant to attach / product has a variant without sku to attach / product has no shop sku to attach |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Missing shop_id (the shop_id is required); shop not bound (the shop is not bound to this channel partner); target is the primary shop (the primary shop cannot be attached to); empty item_ids or more than 50 (item_ids must be an array of at most 50 unique ids); transaction errors return the exception message |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/product/attach' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"shop_id": 21,
"item_ids": [
501,
502
]
}'Shop Product List
/channel/api/v1/shop/product/listAuth: request-token (channel_partner)
Return a paginated product list of one of the partner's bound shops. Rows reuse the product catalog snapshot fields and can be forwarded verbatim as order lines.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
shop_id | integer | recommended | Shop ID; pass it explicitly. A missing or unbound shop returns 200 with an empty list |
page | integer | no | Page number, 1-based. Default 1 |
pageSize | integer | no | Page size, max 100. Default 20 |
keyword | string | no | Fuzzy search on title / shop_sku |
in_stock | integer | string | no | Stock filter: 1 in stock, 0 out of stock; omit for no filter |
Response
{
"code": 200,
"msg": "",
"data": {
"data": [
{
"id": 1501,
"sku": "E2C-BAT-100",
"name": "10 kWh Battery Module",
"price": 1299.00,
"stock_status": "in_stock",
"vip_price_rule": "Partner Tier A",
"master_item_id": 501,
"sale_price": 1299.00,
"weight": 48.5,
"weight_unit": "kg",
"images": { "id": ["https://cdn.example.com/items/501/1.jpg"] },
"primary_image_key": "id",
"variant": {
"shop_sku": "E2C-BAT-100",
"standard": { "capacity": "10kWh" },
"sale_price": 1299.00,
"weight": 48.5,
"weight_unit": "kg"
}
}
],
"total": 1,
"per_page": 20,
"current_page": 1
}
}| Field | Type | Description |
|---|---|---|
data[].id | integer | Shop-side product ID |
data[].sku | string | Shop-side shop_sku (internal variant IDs are never exposed) |
data[].name | string | Title |
data[].price / sale_price | number | null | Rule-engine final price |
data[].stock_status | string | in_stock / out_of_stock |
data[].vip_price_rule | string | Matched rule names, empty when none |
data[].master_item_id | integer | null | Source primary-shop product ID; null for non-attached rows |
data[].weight / weight_unit | number / string | Weight and unit |
data[].images | object | Normalized image map |
data[].primary_image_key | string | Primary image key |
data[].variant | object | First-variant order snapshot (shop_sku / standard / sale_price / weight / weight_unit) |
total | integer | Total match count (unlike product/list, this endpoint returns the real total) |
per_page / current_page | integer | Page size / current page |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 500 | Server error |
Note: a missing or unbound shop_id returns 200 with an empty list, not a 403/404.
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/product/list' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"shop_id": 21,
"page": 1,
"pageSize": 20,
"in_stock": 1
}'Cart Draft List
Path prefix: these 7 endpoints live at
/channel/api/v1/shop/cart-draft/*. The backend route fileapp/channel/route/api.phpnests thecart-draftgroup insideshop. The partner portal'ssrc/lib/api/endpoints.tsstill targets the old/channel/api/v1/cart-draft/*paths, which return 404; the backend routes are authoritative.
/channel/api/v1/shop/cart-draft/listAuth: request-token (channel_partner)
Return all cart drafts of the current member, ordered by updated_at descending. This endpoint is not paginated.
Required capability: none
Request Body
None.
Response
{
"code": 200,
"msg": "success",
"data": [
{
"id": 77,
"member_id": 9001,
"label": "Q4 restock",
"shipping_address": "{\"full_name\":\"Anna Schmidt\",\"city\":\"Hamburg\"}",
"billing_address": "{}",
"items": "[{\"variant_id\":4001,\"sku\":\"E2C-BAT-100\",\"name\":\"10 kWh Battery Module\",\"quantity\":2,\"price\":1299}]",
"currency": "EUR",
"subtotal": 2598.00,
"assigned_staff_id": 12,
"status": "draft",
"pricing_request_id": null,
"created_at": "2026-11-11 09:00:00",
"updated_at": "2026-11-11 09:30:00"
}
]
}| Field | Type | Description |
|---|---|---|
id | integer | Draft ID |
member_id | integer | Owning member |
label | string | Draft label, defaults to Cart |
shipping_address | string | Shipping address as a JSON string |
billing_address | string | Billing address as a JSON string |
items | string | Lines as a JSON string; each entry has variant_id / sku / name / quantity / price |
currency | string | Currency, default EUR |
subtotal | number | string | Subtotal = Σ(price × quantity), 2 decimals; decimal columns may serialize as strings |
assigned_staff_id | integer | null | Assigned pricing staff; null when <= 0 |
status | string | draft / pricing / confirmed / submitted |
pricing_request_id | integer | null | Current pricing request ID |
created_at / updated_at | string | Creation / update time |
Note: rows are returned as stored, so JSON columns are not decoded; any additional columns on the row are also returned.
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 500 | Server error |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/list' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json'Save Cart Draft
/channel/api/v1/shop/cart-draft/saveAuth: request-token (channel_partner)
Create or update a cart draft. id > 0 updates an existing draft, and only draft / confirmed drafts can be updated; id = 0 or omitted creates a new one.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | no | Draft ID; 0 creates a new draft. Default 0 |
label | string | no | Draft label; an empty string is stored as Cart |
shipping_address | object | no | Shipping address, stored as JSON |
billing_address | object | no | Billing address, stored as JSON |
items | array | no | Line items, stored as JSON |
items[].variant_id | integer | yes | Variant ID |
items[].sku | string | no | SKU |
items[].name | string | no | Product name |
items[].quantity | integer | yes | Quantity, default 1 |
items[].price | number | yes | Unit price |
currency | string | no | Currency, default EUR |
assigned_staff_id | integer | no | Assigned pricing staff; <= 0 stores null |
Response
{
"code": 200,
"msg": "success",
"data": { "id": 77 }
}| Field | Type | Description |
|---|---|---|
id | integer | Created or updated draft ID |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Draft missing or owned by another member (cart draft not found); draft is pricing / submitted (cart draft is locked during pricing or after submission) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/save' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 0,
"label": "Q4 restock",
"currency": "EUR",
"shipping_address": {
"full_name": "Anna Schmidt",
"city": "Hamburg",
"country_code": "DE"
},
"items": [
{
"variant_id": 4001,
"sku": "E2C-BAT-100",
"name": "10 kWh Battery Module",
"quantity": 2,
"price": 1299
}
]
}'Delete Cart Draft
/channel/api/v1/shop/cart-draft/deleteAuth: request-token (channel_partner)
Delete a cart draft of the current member and remove its associated pricing request. Any status can be deleted.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Draft ID |
Response
{
"code": 200,
"msg": "success",
"data": []
}Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Missing or non-positive id (id is required) |
Note: a draft that does not exist or belongs to another member still returns success (deletion matches id + member_id). Current implementation: the associated pricing request is deleted by cart_draft_id without re-checking draft ownership, so deleting another member's draft ID removes nothing from that draft but still deletes the pricing request under that ID.
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/delete' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'Submit for Pricing
/channel/api/v1/shop/cart-draft/submit-pricingAuth: request-token (channel_partner)
Submit a draft cart for pricing: a pricing request is created as pending, and the draft moves to pricing.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Draft ID |
remark | string | no | Pricing remark |
Note: the pricing staff is resolved in this order: draft assigned_staff_id → member bind_manager_id → the channel/default_shop_manager/member system setting; when all are empty, staff_id = 0. Each line records variant_id / sku / name / quantity / original_price (from the draft price), with adjusted_price initially null.
Response
{
"code": 200,
"msg": "pricing request submitted",
"data": { "pricing_request_id": 301 }
}| Field | Type | Description |
|---|---|---|
pricing_request_id | integer | New pricing request ID, also written to the draft's pricing_request_id |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Draft missing or owned by another member (cart draft not found); not in draft (only draft cart can submit for pricing); transaction failure (failed to submit pricing request) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/submit-pricing' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77,
"remark": "Please confirm Q4 pricing"
}'Cancel Pricing
/channel/api/v1/shop/cart-draft/cancel-pricingAuth: request-token (channel_partner)
Cancel pricing as the partner: only a pricing draft can be cancelled. The pricing request becomes rejected (remark cancelled by member), and the draft returns to draft with pricing_request_id cleared.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Draft ID |
Response
{
"code": 200,
"msg": "pricing cancelled, cart returned to draft",
"data": []
}Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Draft missing or owned by another member (cart draft not found); not in pricing (only pricing cart can be cancelled); transaction failure (failed to cancel pricing) |
Note: a confirmed draft cannot be cancelled (its prices are already approved); submit for pricing again to change them.
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/cancel-pricing' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'Submit Order
/channel/api/v1/shop/cart-draft/submit-orderAuth: request-token (channel_partner)
Turn a confirmed or draft cart into an order; on success the draft becomes submitted.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Draft ID |
Note: the order is submitted explicitly against the primary shop shop_id and shares the ChannelPartnerOrderService::submitForPartner flow with /order/submit, so the same shop-binding and account-manager checks apply and can return 400: the shop is not bound to this channel partner or no account manager assigned, please contact admin to bind a manager first. shop_order_no (here DRAFT-{id}-{timestamp}) is regenerated on every call and the backend does not deduplicate it, so retrying after a timeout is not idempotent; unknown SKUs reject and roll back the whole order, matching order-submit.
Other ordering conventions: shipping_standard = STD and payment_method = bank_transfer; an empty billing address falls back to the shipping address. Tax is computed via PlaceOrderRepo::getBossTax; on success a fee_code = tax amount line is appended and every line is enriched with vat_amount / tax_rate. A tax failure is only logged and does not block the order. A draft cart can skip pricing and be submitted directly.
Response
{
"code": 200,
"msg": "order submitted",
"data": { "order_id": 88123 }
}| Field | Type | Description |
|---|---|---|
order_id | integer | New order ID |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Draft missing or owned by another member (cart draft not found); status not allowed (cart draft must be confirmed or draft before submitting); primary shop not bound to this partner (the shop is not bound to this channel partner); no account manager assigned (no account manager assigned...); unknown SKUs reject the whole order; order failure returns the exception message |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/submit-order' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'Pricing Status
/channel/api/v1/shop/cart-draft/pricing-statusAuth: request-token (channel_partner)
Return the current draft and associated pricing request status for portal polling.
Required capability: none
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Draft ID |
Response
{
"code": 200,
"msg": "success",
"data": {
"draft_status": "pricing",
"pricing_request": {
"id": 301,
"cart_draft_id": 77,
"member_id": 9001,
"staff_id": 12,
"items": [
{
"variant_id": 4001,
"sku": "E2C-BAT-100",
"name": "10 kWh Battery Module",
"quantity": 2,
"original_price": 1299.00,
"adjusted_price": null,
"remark": ""
}
],
"status": "pending",
"remark": "Please confirm Q4 pricing",
"created_at": "2026-11-11 09:31:00",
"resolved_at": null
}
}
}| Field | Type | Description |
|---|---|---|
draft_status | string | draft / pricing / confirmed / submitted |
pricing_request | object | null | Associated pricing request; null when the draft has no pricing_request_id |
pricing_request.items | array | Decoded line array with variant_id / sku / name / quantity / original_price / adjusted_price / remark |
pricing_request.status | string | pending / in_review / approved / rejected |
pricing_request.remark | string | Pricing remark; overwritten when staff resolves the request |
pricing_request.resolved_at | string | null | Resolution time |
Error Codes
| code | Meaning |
|---|---|
| 909 | Missing/invalid token, or not a channel partner |
| 400 | Draft missing or owned by another member (cart draft not found) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/shop/cart-draft/pricing-status' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 77
}'State Transitions
Cart draft state machine:
| Current status | Action | Result |
|---|---|---|
draft | submit-pricing | pricing; the pricing request is created as pending |
draft | submit-order | submitted (pricing skipped) |
pricing | cancel-pricing | draft; the pricing request becomes rejected |
pricing | Staff rejects | draft; the pricing request becomes rejected and pricing_request_id is cleared |
pricing | Staff approves | confirmed; lines are rewritten with adjusted_price and the subtotal is recalculated |
confirmed | submit-order | submitted |
submitted | — | Terminal; save refuses updates, delete still works |
Pricing request state machine:
| Status | Trigger |
|---|---|
pending | Created by submit-pricing |
in_review | Reserved; no /channel endpoint writes it |
approved | Staff approval (accepts pending / in_review) |
rejected | Staff rejection, or partner cancel-pricing |
Note: save is refused while a draft is pricing / submitted; cancel-pricing only accepts pricing; the staff approval/rejection endpoints are internal and not exposed to partners.