Пересчитать состав корзины
POST
/club/goods.cart.preview
const url = 'https://api.tride.ru/club/goods.cart.preview';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"access_token":"<токен клиента>","club_id":"000000000000000000000001","items":[{"product_id":"000000000000000000000002","quantity":1}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tride.ru/club/goods.cart.preview \ --header 'Content-Type: application/json' \ --data '{ "access_token": "<токен клиента>", "club_id": "000000000000000000000001", "items": [ { "product_id": "000000000000000000000002", "quantity": 1 } ] }'Вызывайте от имени вошедшего клиента: в JSON нужен access_token его клиентской сессии. Порядок подключения.
Request Bodyrequired
Заголовок раздела «Request Bodyrequired»Media typeapplication/json
object
access_token
required
Токен вошедшего клиента.
string
account_context
Выбранная компания или семья: account_id, self_pay
object
club_id
required
Клуб витрины
string
items
required
Корзина: [{product_id, variant_id, quantity}], не больше 30 строк
Array<object>
object
promo_code
Промокод (необязательно)
string
Example
{ "access_token": "<токен клиента>", "club_id": "000000000000000000000001", "items": [ { "product_id": "000000000000000000000002", "quantity": 1 } ]}Responses
Заголовок раздела «Responses»При ошибке сервер возвращает поле error.
Media typeapplication/json
Any of:
object
lines
Строки: product_id, variant_id, quantity, unit_price, price_kind, total, name, variant_value, fileid
Array<object>
object
removed
Убранные строки: product_id, variant_id, reason (out_of_stock|locked|hidden|not_purchasable|variant_required|quantity_reduced), quantity_max
Array<object>
object
subtotal
Сумма строк
string | null
promo
Промокод: valid, code, discount_amount, reason_code
object | null
total
Итого к оплате
string | null
object
error
required
Код или текст ошибки.
string
field
Параметр запроса, если сервер указал его.
string
retry_after
Задержка до следующей попытки в секундах.
integer
Example generated
{ "lines": [ {} ], "removed": [ {} ], "subtotal": "example", "promo": "example", "total": "example"}