Skip to content

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).

HeaderRequiredDescription
request-tokenone of twoChannel partner app token
Authorizationone of twoBearer <token>, user session token or developer secret
Content-Typeyesapplication/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:

codeMeaning
909Missing/invalid token, or not a channel partner
400Parameter or business validation failure
404Resource not found or outside the partner scope
500Server error

Bound Shops ​

POST/channel/api/v1/shop/bound

Auth: 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 ​

json
{
  "code": 200,
  "msg": "shop bound succeed",
  "data": [
    { "id": 21, "name": "Partner Shop DE", "brief": "Germany distribution" }
  ]
}
FieldTypeDescription
idintegerShop (authorize) ID, used as shop_id in /shop/product/attach and shop/product/list
namestringShop name
briefstringShort description, may be empty

Note: when no shop is bound the endpoint returns an empty array while msg stays shop bound succeed.

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
500Server error

cURL ​

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 ​

POST/channel/api/v1/shop/grants

Auth: 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 ​

json
{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "id": 12,
      "grant_id": 12,
      "name": "Shop connector",
      "code": "shop_connector",
      "oauth": false
    }
  ]
}
FieldTypeDescription
id / grant_idintegerGrant definition ID (both identical). grant_id is used by shop/grant-fields; id can be sent as authorization to shop/create
name / codestringGrant name / code
oauthbooleanWhether the grant uses OAuth

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Grant API call failed (failed to fetch grants)

cURL ​

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 ​

POST/channel/api/v1/shop/grant-fields

Auth: 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 ​

FieldTypeRequiredDescription
grant_idintegeryesGrant definition ID from grant_id in shop/grants

Response ​

json
{
  "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": []
    }
  ]
}
FieldTypeDescription
idintegerField definition ID
name / fieldstringDisplay name / submitted field name
placeHolder / helpstringPlaceholder / help text
min / maxintegerNumeric range
minLength / maxLengthintegerText length range
requiredbooleanWhether the field is required
formTypestringForm type, e.g. text / radio / select / checkbox / multiselect
rowsintegerTextarea rows, default 6
fixValuestringFixed value; empty when options are present
options[].key / valuestringOption label / submitted value; options with state = false are dropped

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Missing grant_id (grant_id is required), or the field API call failed (failed to fetch grant fields)

cURL ​

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 ​

POST/channel/api/v1/shop/create

Auth: 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 ​

FieldTypeRequiredDescription
namestringyesShop name
briefstringyesShop description
authorizationintegeryesGrant definition ID (hottol grant id)
propertyobjectnoDynamic form values matching shop/grant-fields; stored in authorize.meta.property

Response ​

json
{
  "code": 200,
  "msg": "shop create succeed",
  "data": { "id": 22, "shop_id": 22 }
}
FieldTypeDescription
id / shop_idintegerNew shop (authorize) ID, both identical

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Missing 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
500Grant 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
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 ​

POST/channel/api/v1/shop/product/attach

Auth: 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 ​

FieldTypeRequiredDescription
shop_idintegeryesTarget shop ID; must be bound to the current partner and must not be the primary shop
item_idsarrayyesPrimary-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 ​

json
{
  "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
      }
    ]
  }
}
FieldTypeDescription
shop_idintegerTarget shop ID
attachedintegerNumber of products attached (item_id not null)
items[].master_item_idintegerPrimary-shop product ID
items[].item_idinteger | nullShop-side product ID; null when skipped
items[].shop_skustringShop-side SKU; empty when skipped
items[].actionstringcreated / updated / skipped
items[].variant_countintegerVariants created or refreshed; 0 when skipped
items[].reasonstringPresent 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 ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Missing 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
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 ​

POST/channel/api/v1/shop/product/list

Auth: 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 ​

FieldTypeRequiredDescription
shop_idintegerrecommendedShop ID; pass it explicitly. A missing or unbound shop returns 200 with an empty list
pageintegernoPage number, 1-based. Default 1
pageSizeintegernoPage size, max 100. Default 20
keywordstringnoFuzzy search on title / shop_sku
in_stockinteger | stringnoStock filter: 1 in stock, 0 out of stock; omit for no filter

Response ​

json
{
  "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
  }
}
FieldTypeDescription
data[].idintegerShop-side product ID
data[].skustringShop-side shop_sku (internal variant IDs are never exposed)
data[].namestringTitle
data[].price / sale_pricenumber | nullRule-engine final price
data[].stock_statusstringin_stock / out_of_stock
data[].vip_price_rulestringMatched rule names, empty when none
data[].master_item_idinteger | nullSource primary-shop product ID; null for non-attached rows
data[].weight / weight_unitnumber / stringWeight and unit
data[].imagesobjectNormalized image map
data[].primary_image_keystringPrimary image key
data[].variantobjectFirst-variant order snapshot (shop_sku / standard / sale_price / weight / weight_unit)
totalintegerTotal match count (unlike product/list, this endpoint returns the real total)
per_page / current_pageintegerPage size / current page

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
500Server error

Note: a missing or unbound shop_id returns 200 with an empty list, not a 403/404.

cURL ​

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 file app/channel/route/api.php nests the cart-draft group inside shop. The partner portal's src/lib/api/endpoints.ts still targets the old /channel/api/v1/cart-draft/* paths, which return 404; the backend routes are authoritative.

POST/channel/api/v1/shop/cart-draft/list

Auth: 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 ​

json
{
  "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"
    }
  ]
}
FieldTypeDescription
idintegerDraft ID
member_idintegerOwning member
labelstringDraft label, defaults to Cart
shipping_addressstringShipping address as a JSON string
billing_addressstringBilling address as a JSON string
itemsstringLines as a JSON string; each entry has variant_id / sku / name / quantity / price
currencystringCurrency, default EUR
subtotalnumber | stringSubtotal = Σ(price × quantity), 2 decimals; decimal columns may serialize as strings
assigned_staff_idinteger | nullAssigned pricing staff; null when <= 0
statusstringdraft / pricing / confirmed / submitted
pricing_request_idinteger | nullCurrent pricing request ID
created_at / updated_atstringCreation / 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 ​

codeMeaning
909Missing/invalid token, or not a channel partner
500Server error

cURL ​

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 ​

POST/channel/api/v1/shop/cart-draft/save

Auth: 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 ​

FieldTypeRequiredDescription
idintegernoDraft ID; 0 creates a new draft. Default 0
labelstringnoDraft label; an empty string is stored as Cart
shipping_addressobjectnoShipping address, stored as JSON
billing_addressobjectnoBilling address, stored as JSON
itemsarraynoLine items, stored as JSON
items[].variant_idintegeryesVariant ID
items[].skustringnoSKU
items[].namestringnoProduct name
items[].quantityintegeryesQuantity, default 1
items[].pricenumberyesUnit price
currencystringnoCurrency, default EUR
assigned_staff_idintegernoAssigned pricing staff; <= 0 stores null

Response ​

json
{
  "code": 200,
  "msg": "success",
  "data": { "id": 77 }
}
FieldTypeDescription
idintegerCreated or updated draft ID

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Draft 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
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 ​

POST/channel/api/v1/shop/cart-draft/delete

Auth: 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 ​

FieldTypeRequiredDescription
idintegeryesDraft ID

Response ​

json
{
  "code": 200,
  "msg": "success",
  "data": []
}

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Missing 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
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 ​

POST/channel/api/v1/shop/cart-draft/submit-pricing

Auth: 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 ​

FieldTypeRequiredDescription
idintegeryesDraft ID
remarkstringnoPricing 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 ​

json
{
  "code": 200,
  "msg": "pricing request submitted",
  "data": { "pricing_request_id": 301 }
}
FieldTypeDescription
pricing_request_idintegerNew pricing request ID, also written to the draft's pricing_request_id

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Draft 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
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 ​

POST/channel/api/v1/shop/cart-draft/cancel-pricing

Auth: 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 ​

FieldTypeRequiredDescription
idintegeryesDraft ID

Response ​

json
{
  "code": 200,
  "msg": "pricing cancelled, cart returned to draft",
  "data": []
}

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Draft 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
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 ​

POST/channel/api/v1/shop/cart-draft/submit-order

Auth: request-token (channel_partner)

Turn a confirmed or draft cart into an order; on success the draft becomes submitted.

Required capability: none

Request Body ​

FieldTypeRequiredDescription
idintegeryesDraft 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 ​

json
{
  "code": 200,
  "msg": "order submitted",
  "data": { "order_id": 88123 }
}
FieldTypeDescription
order_idintegerNew order ID

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Draft 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
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 ​

POST/channel/api/v1/shop/cart-draft/pricing-status

Auth: request-token (channel_partner)

Return the current draft and associated pricing request status for portal polling.

Required capability: none

Request Body ​

FieldTypeRequiredDescription
idintegeryesDraft ID

Response ​

json
{
  "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
    }
  }
}
FieldTypeDescription
draft_statusstringdraft / pricing / confirmed / submitted
pricing_requestobject | nullAssociated pricing request; null when the draft has no pricing_request_id
pricing_request.itemsarrayDecoded line array with variant_id / sku / name / quantity / original_price / adjusted_price / remark
pricing_request.statusstringpending / in_review / approved / rejected
pricing_request.remarkstringPricing remark; overwritten when staff resolves the request
pricing_request.resolved_atstring | nullResolution time

Error Codes ​

codeMeaning
909Missing/invalid token, or not a channel partner
400Draft missing or owned by another member (cart draft not found)

cURL ​

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 statusActionResult
draftsubmit-pricingpricing; the pricing request is created as pending
draftsubmit-ordersubmitted (pricing skipped)
pricingcancel-pricingdraft; the pricing request becomes rejected
pricingStaff rejectsdraft; the pricing request becomes rejected and pricing_request_id is cleared
pricingStaff approvesconfirmed; lines are rewritten with adjusted_price and the subtotal is recalculated
confirmedsubmit-ordersubmitted
submitted—Terminal; save refuses updates, delete still works

Pricing request state machine:

StatusTrigger
pendingCreated by submit-pricing
in_reviewReserved; no /channel endpoint writes it
approvedStaff approval (accepts pending / in_review)
rejectedStaff 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.