nhanh.v3.0.order.add
POST/v3.0/order/addVia 360: POST https://partner.quantri360.com/v1/nhanh/v3.0/order/add
Coming soon. This API already runs in production through 360 and pricing is being finalised — you can read the docs and prepare your integration now.
Write endpoint — changes data on Nhanh.vn. 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 đơn hàng mới trên Nhanh từ hệ thống của bạn (web, chat, sàn…): khách nhận, sản phẩm, kho, vận chuyển, thanh toán. Đơn gắn kho sẽ tính tạm giữ / đang chuyển như đơn tạo trên trang quản trị Nhanh; có thể gửi luôn sang hãng vận chuyển (carrier.autoSend).
- Là API GHI — thay đổi dữ liệu thật trên Nhanh.vn (tạo đơn, giữ tồn kho); key cần quyền ghi.
- Địa chỉ nhận đặt trong object
shippingAddress(viết liền, chữ A hoa). - Luôn gửi
channel.appOrderIdduy nhất cho mỗi đơn để gọi lại an toàn khi mạng lỗi. products[].idlà id sản phẩm Nhanh (không phải SKU) — tra bằng /v3.0/product/list (filters.name = SKU).
Request
Endpoint
POST https://partner.quantri360.com/v1/nhanh/v3.0/order/add
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 |
|---|---|---|---|---|---|
| channel.appOrderId | body | string | Yes | web-100234 | Mã đơn bên hệ thống của bạn — Nhanh chặn trùng theo app + appOrderId (gửi lại cùng mã không tạo đơn thứ hai). |
| channel.sourceName | body | string | No | Website | Tên nguồn đơn. |
| info.depotId | body | int | No | 104484 | Kho xuất hàng (/v3.0/business/depot). |
| info.type | body | int | No | 1 | Loại đơn — mặc định 1 giao hàng tận nhà. |
| info.status | body | int | No | Trạng thái ban đầu — chỉ được: Mới, Chờ xác nhận, Đang xác nhận, Đã xác nhận. | |
| info.saleId | body | int | No | Nhân viên bán. | |
| info.createdById | body | int | No | Người tạo. | |
| info.description | body | string | No | Giao giờ hành chính | Ghi chú đơn. |
| info.privateDescription | body | string | No | Ghi chú chăm sóc khách (nội bộ). | |
| info.tagIds | body | int[] | No | Nhãn đơn. | |
| shippingAddress.name | body | string | Yes | nguoimua123 | Tên người nhận. |
| shippingAddress.mobile | body | string | Yes | 0901234567 | SĐT người nhận. |
| shippingAddress.address | body | string | No | Số 1 đường ABC | Địa chỉ chi tiết. |
| shippingAddress.email | body | string | No | ||
| shippingAddress.locationVersion | body | string | No | v2 | v1 = địa giới cũ 3 cấp · v2 = địa giới mới 2 cấp (id lấy ở /v3.0/shipping/location cùng bản). |
| shippingAddress.cityId | body | int | No | 254 | Id tỉnh / thành. |
| shippingAddress.districtId | body | int | No | Id quận / huyện — bắt buộc khi v1, bỏ khi v2. | |
| shippingAddress.wardId | body | int | No | Id phường / xã. | |
| products | body | object[] | Yes | [{"id": 40388315, "price": 299000, "quantity": 1}] | Dòng hàng (tối đa 500): id (id sản phẩm Nhanh, bắt buộc), price (bắt buộc), quantity (bắt buộc), discount (giảm cho cả dòng), vat, priceVatMode, imeis[], description, gifts[] {id, quantity, price}. |
| carrier | body | object | No | Vận chuyển: id hãng, sendCarrierType (1 kết nối của Nhanh · 2 tài khoản riêng của shop), serviceId / serviceCode / accountId / shopId (lấy từ tính phí vận chuyển), customerShipFee (phí ship báo khách), allowTest (1 cho xem không thử · 2 cho thử · 3 không cho xem · 4 cho xem, không lấy thu ship), isDeclaredFee + declaredValue (khai giá), orderPackage {weight gram, length, width, height}, autoSend = 1 (gửi luôn sang hãng, trả carrierCode). | |
| payment | body | object | No | Thanh toán: depositAmount + depositAccountId (đặt cọc), transferAmount + transferAccountId (chuyển khoản), couponCode, usedPoints, discountAmount + discountType (cash / percent, giảm cả đơn). | |
| invoice | body | object | No | Xuất hóa đơn: tax {type 1 hộ KD · 2 công ty · 3 cá nhân, code (MST), name, address…}, contact {name, mobile, email}. |
Request examples
curl -s -X POST "https://partner.quantri360.com/v1/nhanh/v3.0/order/add" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"channel":{"appOrderId":"web-100234","sourceName":"Website"},"info":{"depotId":104484,"description":"Giao giờ hành chính"},"shippingAddress":{"name":"nguoimua123","mobile":"0901234567","address":"Số 1 đường ABC","locationVersion":"v2","cityId":254,"wardId":1100},"products":[{"id":40388315,"price":299000,"quantity":1}],"payment":{"discountAmount":20000,"discountType":"cash"}}'
Python
import requests
KEY = "q360_live_..." # khóa API của brand
r = requests.post(
"https://partner.quantri360.com/v1/nhanh/v3.0/order/add",
params={},
json={
"channel": {
"appOrderId": "web-100234",
"sourceName": "Website"
},
"info": {
"depotId": 104484,
"description": "Giao giờ hành chính"
},
"shippingAddress": {
"name": "nguoimua123",
"mobile": "0901234567",
"address": "Số 1 đường ABC",
"locationVersion": "v2",
"cityId": 254,
"wardId": 1100
},
"products": [
{
"id": 40388315,
"price": 299000,
"quantity": 1
}
],
"payment": {
"discountAmount": 20000,
"discountType": "cash"
}
},
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/nhanh/v3.0/order/add');
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({"channel":{"appOrderId":"web-100234","sourceName":"Website"},"info":{"depotId":104484,"description":"Giao giờ hành chính"},"shippingAddress":{"name":"nguoimua123","mobile":"0901234567","address":"Số 1 đường ABC","locationVersion":"v2","cityId":254,"wardId":1100},"products":[{"id":40388315,"price":299000,"quantity":1}],"payment":{"discountAmount":20000,"discountType":"cash"}}),
});
console.log(r.status, await r.json());PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/nhanh/v3.0/order/add' . '?' . 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, '{"channel":{"appOrderId":"web-100234","sourceName":"Website"},"info":{"depotId":104484,"description":"Giao giờ hành chính"},"shippingAddress":{"name":"nguoimua123","mobile":"0901234567","address":"Số 1 đường ABC","locationVersion":"v2","cityId":254,"wardId":1100},"products":[{"id":40388315,"price":299000,"quantity":1}],"payment":{"discountAmount":20000,"discountType":"cash"}}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;Response
Response fields (as returned by Nhanh.vn)
| Name | Type | Sample | Description |
|---|---|---|---|
| code | int | 1 | 1 = thành công; 0 = lỗi (xem `errorCode`, `messages`). |
| messages | string[] | Thông điệp lỗi (có thể là object theo tên trường). | |
| data | object | Đơn vừa tạo. | |
| id | int | Id đơn Nhanh. | |
| trackingUrl | string | Trang theo dõi lịch trình đơn. | |
| carrierCode | string | Mã vận đơn hãng vận chuyển — chỉ có khi carrier.autoSend = 1 và gửi thành công. |
Response sample
{
"code": 1,
"data": {
"id": 123456789,
"trackingUrl": "…",
"carrierCode": ""
}
}
Get started
- Sign up for Partner
- Enable a data type of the Đơn hàng group on the platform page
- Create an API key (tick the Nhanh.vn channel)
- Call it as in the examples above