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
| Name | In | Type | Sample | Description |
|---|---|---|---|---|
| Authorization | header | header | Bearer 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_id | query | string | 100001 | Gian 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
| Name | In | Type | Required | Sample | Description |
|---|---|---|---|---|---|
| rule_type | body | int32 | Yes | 1 | Loạ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_value | body | float | No | 0 | Số tiền được giảm khi mua bộ; dùng khi rule_type=3. |
| fix_price | body | float | No | 90000 | Giá người mua trả cho bộ; dùng khi rule_type=1. |
| discount_percentage | body | int32 | No | 0 | Phần trăm giảm giá khi mua bộ; dùng khi rule_type=2. |
| min_amount | body | int32 | Yes | 2 | Số lượng sản phẩm người mua phải mua cùng nhau để đạt mức ưu đãi. |
| start_time | body | timestamp | Yes | 1794009600 | Thời điểm bắt đầu, Unix giây; phải sau thời điểm hiện tại. |
| end_time | body | timestamp | Yes | 1794182400 | Thời điểm kết thúc, Unix giây; sau bắt đầu ít nhất 1 giờ. |
| name | body | string | Yes | Ưu đãi minh họa | Tên chương trình. |
| purchase_limit | body | int32 | Yes | 1 | Số bộ tối đa một người mua có thể mua. |
| additional_tiers | body | object[] | 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_amount | body | int32 | Yes | 2 | Số lượng sản phẩm người mua phải mua cùng nhau để đạt mức ưu đãi. |
| additional_tiers[].fix_price | body | float | No | 90000 | Giá người mua trả cho bộ; dùng khi rule_type=1. |
| additional_tiers[].discount_value | body | float | No | 0 | Số tiền được giảm khi mua bộ; dùng khi rule_type=3. |
| additional_tiers[].discount_percentage | body | int32 | No | 0 | Phầ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ả.
| Name | Type | Sample | Description |
|---|---|---|---|
| request_id | string | d52ca43b277a4f9292fb8be658bfd33d | Mã request của Shopee để tra lỗi. |
| error | string | Mã lỗi Shopee; rỗng = thành công. | |
| message | string | Mô tả lỗi. | |
| response | object | Kết quả xử lý. | |
| bundle_deal_id | int64 | 100002 | Mã 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
| Code | Meaning |
|---|---|
| add_on.add_on_no_logistic | Sản phẩm chưa có kênh vận chuyển. |
| add_on.add_on_deal_item_under_block_categories | Sản phẩm thuộc ngành bị cấm khuyến mãi theo thị trường. |
| bundle.bundle_deal_discount_value_invalid_range | Số tiền giảm ngoài khoảng giá cho phép. |
| bundle.bundle_deal_start_time_error | Thờ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_limit | Tối đa 1000 chương trình mua theo bộ. |
| bundle.bundle_deal_error_unknown | Lỗi chưa xác định của dịch vụ mua theo bộ. |
| bundle.bundle_deal_exceed_remaining_time_limit | Kết thúc phải trước thời điểm tối đa được phép. |
| bundle.bundle_deal_fix_price_invalid_range | Giá bộ ngoài khoảng cho phép. |
| bundle.bunde_deal_multi_tier_invalid_discount | Mứ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_item | Mứ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_toggle | Chưa được tạo chương trình nhiều mức. |
| bundle.bundle_deal_name_length | Tê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_amount | Không đổi min_amount khi đang diễn ra và có sản phẩm bật. |
| bundle.bundle_deal_over_min_amount | Số lượng sản phẩm không được vượt 3000. |
| bundle.bundle_deal_over_tier | Tối đa 3 mức ưu đãi. |
| bundle.bundle_deal_rule_type_mix_use | Các mức phải dùng cùng loại quy tắc. |
| bundle.bundle_deal_rule_type_value | Loại quy tắc mua theo bộ không hợp lệ. |
| bundle.bundle_deal_tier_invalid | Mức đầu phải giảm dưới 90%. |
| bundle.bundle_deal_under_min_amount | Số lượng sản phẩm phải lớn hơn 1. |
| bundle.bundle_deal_under_min_amount_multi_tier | Số lượng mức sau phải lớn hơn mức trước. |
| bundle.bundle_deal_invaild_discount_percentage | Phần trăm giảm phải từ 1 đến 99. |
| bundle.bundle_deal_min_span_within | Thời gian khuyến mãi phải trên 1 giờ. |
| error_data | Dữ 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_param | Tham số sai / thiếu / sai kiểu — xem `message` để biết tham số nào. |
| error_server | Lỗi hệ thống Shopee — thử lại sau ít phút. |
| error_shop | Gian 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_limit | Chạ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_limit | Gọ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_banned | Gian hàng đang bị Shopee khóa — mọi API tạm ngưng tới khi gỡ khóa. |
| error_kyc_auth | Gian hàng chưa hoàn tất đăng ký người bán trên Kênh Người Bán. |
Get started
- Sign up for Partner
- Enable a data type of the Khuyến mãi (Marketing) group on the platform page
- Create an API key (tick the Shopee channel)
- Call it as in the examples above