VI | EN
Message us on Messenger
Developer resources

Thêm đơn hàng — Nhanh.vn API

nhanh.v3.0.order.add · 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.

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.appOrderId duy nhất cho mỗi đơn để gọi lại an toàn khi mạng lỗi.
  • products[].id là 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

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
channel.appOrderIdbodystringYesweb-100234Mã đơ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.sourceNamebodystringNoWebsiteTên nguồn đơn.
info.depotIdbodyintNo104484Kho xuất hàng (/v3.0/business/depot).
info.typebodyintNo1Loại đơn — mặc định 1 giao hàng tận nhà.
info.statusbodyintNoTrạng thái ban đầu — chỉ được: Mới, Chờ xác nhận, Đang xác nhận, Đã xác nhận.
info.saleIdbodyintNoNhân viên bán.
info.createdByIdbodyintNoNgười tạo.
info.descriptionbodystringNoGiao giờ hành chínhGhi chú đơn.
info.privateDescriptionbodystringNoGhi chú chăm sóc khách (nội bộ).
info.tagIdsbodyint[]NoNhãn đơn.
shippingAddress.namebodystringYesnguoimua123Tên người nhận.
shippingAddress.mobilebodystringYes0901234567SĐT người nhận.
shippingAddress.addressbodystringNoSố 1 đường ABCĐịa chỉ chi tiết.
shippingAddress.emailbodystringNo
shippingAddress.locationVersionbodystringNov2v1 = đị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.cityIdbodyintNo254Id tỉnh / thành.
shippingAddress.districtIdbodyintNoId quận / huyện — bắt buộc khi v1, bỏ khi v2.
shippingAddress.wardIdbodyintNoId phường / xã.
productsbodyobject[]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}.
carrierbodyobjectNoVậ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).
paymentbodyobjectNoThanh toán: depositAmount + depositAccountId (đặt cọc), transferAmount + transferAccountId (chuyển khoản), couponCode, usedPoints, discountAmount + discountType (cash / percent, giảm cả đơn).
invoicebodyobjectNoXuấ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)

NameTypeSampleDescription
codeint11 = thành công; 0 = lỗi (xem `errorCode`, `messages`).
messagesstring[]Thông điệp lỗi (có thể là object theo tên trường).
dataobjectĐơn vừa tạo.
idintId đơn Nhanh.
trackingUrlstringTrang theo dõi lịch trình đơn.
carrierCodestringMã 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

  1. Sign up for Partner
  2. Enable a data type of the Đơn hàng group on the platform page
  3. Create an API key (tick the Nhanh.vn channel)
  4. Call it as in the examples above