VI | EN
Message us on Messenger
Developer resources

create bundle deal — Shopee API

v2.bundle_deal.add_bundle_deal · call it through Quantri360 with one API key for your own accounts / assets that you connected and authorized — 360 handles request signing and refreshing the authorization you granted.

v2.bundle_deal.add_bundle_deal

POST/api/v2/bundle_deal/add_bundle_dealVia 360: POST https://partner.quantri360.com/v1/shopee/api/v2/bundle_deal/add_bundle_deal
Write endpoint — changes data on Shopee. The key must be created with "Allow write API calls" ticked, otherwise you get 403 write_not_allowed. Every call is logged.
Description

Tạo chương trình mua theo bộ với quy tắc giá cố định, giảm phần trăm hoặc giảm số tiền.

  • Gọi qua /v1/shopee/api/v2/bundle_deal/add_bundle_deal với Authorization: Bearer <key>; dùng platform_shop_id khi có nhiều shop. 360 tự gắn partner_id, shop_id, sign và access_token.
  • API GHI: thay đổi dữ liệu thật trên Shopee; cần key có quyền ghi (can_write) và gói mở module Khuyến mãi. Thay đổi cấu hình ưu đãi hoặc giá khuyến mãi người mua thấy.
  • HTTP 200 vẫn có thể có lỗi nghiệp vụ; kiểm error trước khi dùng kết quả.
  • rule_type=1 gửi fix_price; rule_type=2 gửi discount_percentage; rule_type=3 gửi discount_value.
  • Tối đa 1000 chương trình; tên dài 1–25 ký tự; min_amount >1 và <=3000; tối đa 3 mức, mức sau cần số lượng lớn hơn mức trước. discount_percentage từ 1 đến 99; mức đầu giảm dưới 90%. Thời gian trên 1 giờ và không quá 6 tháng.

Request

Endpoint

POST https://partner.quantri360.com/v1/shopee/api/v2/bundle_deal/add_bundle_deal

Authentication & shop

NameInTypeSampleDescription
AuthorizationheaderheaderBearer q360_live_ab12cd34_…Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand.
platform_shop_idquerystring100001Gian hàng (lấy ở GET /v1/platforms → shops[].platform_shop_id). BẮT BUỘC khi brand có > 1 gian hàng trên nền tảng; 360 bỏ tham số này trước khi chuyển tiếp.

Request parameters

NameInTypeRequiredSampleDescription
rule_typebodyint32Yes1Loại mua theo bộ: 1 = FIX_PRICE (giá cố định), 2 = DISCOUNT_PERCENTAGE (giảm phần trăm), 3 = DISCOUNT_VALUE (giảm số tiền).
discount_valuebodyfloatNo0Số tiền được giảm khi mua bộ; dùng khi rule_type=3.
fix_pricebodyfloatNo90000Giá người mua trả cho bộ; dùng khi rule_type=1.
discount_percentagebodyint32No0Phần trăm giảm giá khi mua bộ; dùng khi rule_type=2.
min_amountbodyint32Yes2Số lượng sản phẩm người mua phải mua cùng nhau để đạt mức ưu đãi.
start_timebodytimestampYes1794009600Thời điểm bắt đầu, Unix giây; phải sau thời điểm hiện tại.
end_timebodytimestampYes1794182400Thời điểm kết thúc, Unix giây; sau bắt đầu ít nhất 1 giờ.
namebodystringYesƯu đãi minh họaTên chương trình.
purchase_limitbodyint32Yes1Số bộ tối đa một người mua có thể mua.
additional_tiersbodyobject[]No[{"min_amount":2,"fix_price":90000,"discount_value":0,"discount_percentage":0}]Các mức ưu đãi bổ sung, tối đa 2 mức; fix_price, discount_percentage, discount_value phải nhất quán với mức đầu theo cùng loại quy tắc.
additional_tiers[].min_amountbodyint32Yes2Số lượng sản phẩm người mua phải mua cùng nhau để đạt mức ưu đãi.
additional_tiers[].fix_pricebodyfloatNo90000Giá người mua trả cho bộ; dùng khi rule_type=1.
additional_tiers[].discount_valuebodyfloatNo0Số tiền được giảm khi mua bộ; dùng khi rule_type=3.
additional_tiers[].discount_percentagebodyint32No0Phần trăm giảm giá khi mua bộ; dùng khi rule_type=2.

Request examples

curl -s -X POST "https://partner.quantri360.com/v1/shopee/api/v2/bundle_deal/add_bundle_deal" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"rule_type":1,"fix_price":90000,"min_amount":2,"start_time":1794009600,"end_time":1794182400,"name":"Ưu đãi minh họa","purchase_limit":1}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/shopee/api/v2/bundle_deal/add_bundle_deal",
    params={},
    json={
        "rule_type": 1,
        "fix_price": 90000,
        "min_amount": 2,
        "start_time": 1794009600,
        "end_time": 1794182400,
        "name": "Ưu đãi minh họa",
        "purchase_limit": 1
    },
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=60,
)
print(r.status_code)
print(r.json())
Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/shopee/api/v2/bundle_deal/add_bundle_deal');
for (const [k, v] of Object.entries({})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'POST',
  headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"rule_type":1,"fix_price":90000,"min_amount":2,"start_time":1794009600,"end_time":1794182400,"name":"Ưu đãi minh họa","purchase_limit":1}),
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/shopee/api/v2/bundle_deal/add_bundle_deal' . '?' . http_build_query([]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"rule_type":1,"fix_price":90000,"min_amount":2,"start_time":1794009600,"end_time":1794182400,"name":"Ưu đãi minh họa","purchase_limit":1}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Response fields (as returned by Shopee)

Phản hồi minh họa thành công; đọc error/message trước khi dùng kết quả.

NameTypeSampleDescription
request_idstringd52ca43b277a4f9292fb8be658bfd33dMã request của Shopee để tra lỗi.
errorstringMã lỗi Shopee; rỗng = thành công.
messagestringMô tả lỗi.
responseobjectKết quả xử lý.
bundle_deal_idint64100002Mã chương trình mua theo bộ.

Response sample

{
  "request_id": "demo-request",
  "error": "",
  "message": "",
  "response": {
    "bundle_deal_id": 100002
  }
}

Shopee error codes (33)

Show
CodeMeaning
add_on.add_on_no_logisticSản phẩm chưa có kênh vận chuyển.
add_on.add_on_deal_item_under_block_categoriesSản phẩm thuộc ngành bị cấm khuyến mãi theo thị trường.
bundle.bundle_deal_discount_value_invalid_rangeSố tiền giảm ngoài khoảng giá cho phép.
bundle.bundle_deal_start_time_errorThời điểm bắt đầu không hợp lệ hoặc không được phép thay đổi; xem `message`.
bundle.bundle_deal_error_total_count_limitTối đa 1000 chương trình mua theo bộ.
bundle.bundle_deal_error_unknownLỗi chưa xác định của dịch vụ mua theo bộ.
bundle.bundle_deal_exceed_remaining_time_limitKết thúc phải trước thời điểm tối đa được phép.
bundle.bundle_deal_fix_price_invalid_rangeGiá bộ ngoài khoảng cho phép.
bundle.bunde_deal_multi_tier_invalid_discountMức cao hơn phải có giảm giá hoặc giá bộ lớn hơn hay bằng mức trước.
bundle.bundle_deal_multi_tier_invalid_discount_with_equal_errorƯu đãi mức cao hơn phải bằng hoặc lớn hơn mức trước.
bundle.bundle_deal_multi_tier_invalid_fix_price_per_itemMức cao hơn phải có giá mỗi sản phẩm thấp hơn (fix_price/min_amount).
bundle.bundle_deal_multi_tier_feature_toggleChưa được tạo chương trình nhiều mức.
bundle.bundle_deal_name_lengthTên phải dài 1–25 ký tự.
bundle.bundle_deal_ongoing_promotion_info_lockĐang diễn ra không đổi loại quy tắc, giá, mức giảm hoặc số mức.
bundle.bundle_deal_ongoing_promotion_info_lock_min_amountKhông đổi min_amount khi đang diễn ra và có sản phẩm bật.
bundle.bundle_deal_over_min_amountSố lượng sản phẩm không được vượt 3000.
bundle.bundle_deal_over_tierTối đa 3 mức ưu đãi.
bundle.bundle_deal_rule_type_mix_useCác mức phải dùng cùng loại quy tắc.
bundle.bundle_deal_rule_type_valueLoại quy tắc mua theo bộ không hợp lệ.
bundle.bundle_deal_tier_invalidMức đầu phải giảm dưới 90%.
bundle.bundle_deal_under_min_amountSố lượng sản phẩm phải lớn hơn 1.
bundle.bundle_deal_under_min_amount_multi_tierSố lượng mức sau phải lớn hơn mức trước.
bundle.bundle_deal_invaild_discount_percentagePhần trăm giảm phải từ 1 đến 99.
bundle.bundle_deal_min_span_withinThời gian khuyến mãi phải trên 1 giờ.
error_dataDữ liệu không tồn tại hoặc không hợp lệ cho thao tác (vd mã không có, loại yêu cầu không cho phép).
error_paramTham số sai / thiếu / sai kiểu — xem `message` để biết tham số nào.
error_serverLỗi hệ thống Shopee — thử lại sau ít phút.
error_shopGian hàng không hợp lệ — kiểm tra platform_shop_id.
error_authỦy quyền gian hàng cho 360 đã hết hạn hoặc bị thu hồi (360 đã tự làm mới token một lần) — chủ gian hàng kết nối lại Shopee trong Partner.
error_limitChạm hạn mức gọi Shopee trong ngày của kết nối — 360 trả kèm thời điểm thử lại; giảm tần suất gọi.
error_rate_limitGọi quá nhanh — chờ vài giây rồi gọi lại (360 cũng giới hạn theo key: 429 + Retry-After).
shop_bannedGian hàng đang bị Shopee khóa — mọi API tạm ngưng tới khi gỡ khóa.
error_kyc_authGian hàng chưa hoàn tất đăng ký người bán trên Kênh Người Bán.

Get started

  1. Sign up for Partner
  2. Enable a data type of the Khuyến mãi (Marketing) group on the platform page
  3. Create an API key (tick the Shopee channel)
  4. Call it as in the examples above