VI | EN
Nhắn Messenger
Dành cho developer

Lấy chi tiết tiền về và phí sàn của một đơn — API Shopee

v2.payment.get_escrow_detail · gọi qua Quantri360 bằng một API key cho chính tài khoản / tài sản bạn đã kết nối và ủy quyền — 360 lo việc ký request và làm mới phiên đăng nhập bạn đã cấp.

v2.payment.get_escrow_detail

GET/api/v2/payment/get_escrow_detailGọi qua 360: GET https://partner.quantri360.com/v1/shopee/api/v2/payment/get_escrow_detail
Mô tả API

Chi tiết tiền của MỘT đơn: khách trả bao nhiêu, giảm giá của shop / Shopee, từng khoản phí sàn (cố định, dịch vụ, thanh toán, affiliate…), phí vận chuyển và số tiền người bán thực nhận (escrow_amount). Cùng nội dung với get_escrow_detail_batch nhưng một đơn mỗi lần — dùng khi tra lẻ (màn hình chi tiết đơn, đối soát một đơn khiếu nại).

  • Mã đơn sai hoặc không thuộc gian hàng → error: "order_not_found", message "Order SN provided is invalid or does not belong to you…".
  • Tra nhiều đơn: dùng get_escrow_detail_batch (≤ 50 đơn / lần) thay vì gọi lặp API này.
  • Đối chiếu (ví dụ thật): 275.600 − 48.506 − 18.158 − 16.536 − 2.436 − 2.700 = 187.264 = escrow_amount. Nhiều trường chỉ có ở thị trường khác (BR, ID, MY…) và luôn bằng 0 với gian hàng VN.
  • Mọi số tiền là VND, số nguyên dạng float.

Request

Địa chỉ

GET https://partner.quantri360.com/v1/shopee/api/v2/payment/get_escrow_detail

Xác thực & gian hàng

TênVị tríKiểuMẫuMô tả
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.

Tham số request

TênVị tríKiểuBắt buộcMẫuMô tả
order_snquerystringCó2610230ABCDE15Mã đơn Shopee (một mã).

Ví dụ request

curl -s "https://partner.quantri360.com/v1/shopee/api/v2/payment/get_escrow_detail?order_sn=2610230ABCDE15" \
  -H "Authorization: Bearer $KEY"
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.get(
    "https://partner.quantri360.com/v1/shopee/api/v2/payment/get_escrow_detail",
    params={
        "order_sn": "2610230ABCDE15"
    },
    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/payment/get_escrow_detail');
for (const [k, v] of Object.entries({"order_sn":"2610230ABCDE15"})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'GET',
  headers: { Authorization: `Bearer ${KEY}` },
});
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/payment/get_escrow_detail' . '?' . http_build_query(['order_sn' => '2610230ABCDE15']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]);
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Tham số phản hồi (nguyên của Shopee)

TênKiểuMẫuMô tả
request_idstringd52ca43b277a4f9292fb8be658bfd33dMã request của Shopee để tra lỗi.
errorstringMã lỗi Shopee; rỗng = thành công.
messagestringMô tả lỗi.
responseobjectMột đơn (không phải mảng như bản batch).
order_snstring2610230ABCDE15Mã đơn.
buyer_user_namestringnguoimua123Tên tài khoản người mua.
return_order_sn_liststring[][]Mã yêu cầu trả hàng của đơn (nếu có).
order_incomeobjectDòng tiền của đơn (khoảng 90 trường; dưới đây là các trường dùng với gian hàng VN — ý nghĩa như get_escrow_detail_batch).
escrow_amountfloat187264Người bán THỰC NHẬN. Có thể đổi tới khi đơn hoàn tất (trả hàng, điều chỉnh phí).
escrow_amount_after_adjustmentfloat187264Tiền thực nhận sau các điều chỉnh của Shopee. Khớp `released_amount` của get_income_detail.
total_adjustment_amountfloat0Tổng điều chỉnh sau quyết toán (âm = Shopee trừ thêm).
order_original_pricefloat689000Giá gốc (trước mọi giảm giá).
order_seller_discountfloat413400Shop giảm giá.
cost_of_goods_soldfloat275600Tiền hàng sau giảm giá của shop.
voucher_from_sellerfloat0Voucher của shop.
voucher_from_shopeefloat50000Voucher Shopee tài trợ (không trừ vào người bán).
seller_voucher_codestring[]["SVIPDDV0109M50C100"]Mã voucher áp cho đơn.
buyer_total_amountfloat225600Khách thực trả.
commission_feefloat48506Phí cố định.
service_feefloat18158Phí dịch vụ.
seller_transaction_feefloat16536Phí thanh toán.
credit_card_transaction_feefloat16536Phí giao dịch thẻ — cùng giá trị với seller_transaction_fee, KHÔNG cộng hai lần.
order_ams_commission_feefloat2436Hoa hồng affiliate.
shipping_seller_protection_fee_amountfloat2700Phí bảo hiểm / dịch vụ vận chuyển người bán đăng ký.
actual_shipping_feefloat41000Phí vận chuyển thực.
estimated_shipping_feefloat41000Phí vận chuyển ước tính lúc đặt.
shopee_shipping_rebatefloat41000Shopee trợ giá vận chuyển.
buyer_paid_shipping_feefloat0Khách trả phí ship.
reverse_shipping_feefloat0Phí vận chuyển chiều hoàn.
seller_return_refundfloat0Tiền hoàn cho khách khi trả hàng (âm).
withholding_vat_taxfloat0Thuế GTGT Shopee khấu trừ.
withholding_pit_taxfloat0Thuế TNCN Shopee khấu trừ.
itemsobject[]Từng dòng hàng: item_id, item_name, item_sku, model_id, model_name, model_sku, quantity_purchased, original_price, discounted_price, selling_price, seller_discount, discount_from_voucher_shopee / _seller, ams_commission_fee, line_item_id, promotion_list…
buyer_payment_infoobjectẢnh chụp lúc đặt hàng: buyer_payment_method, buyer_total_amount, merchant_subtotal, shopee_voucher (âm), seller_voucher, shipping_fee…

Mẫu phản hồi

{
  "error": "",
  "message": "",
  "request_id": "08ba69875ef6cd6f…",
  "response": {
    "order_sn": "2610230ABCDE15",
    "buyer_user_name": "nguoimua123",
    "return_order_sn_list": [],
    "order_income": {
      "escrow_amount": 187264,
      "escrow_amount_after_adjustment": 187264,
      "total_adjustment_amount": 0,
      "order_original_price": 689000,
      "order_seller_discount": 413400,
      "cost_of_goods_sold": 275600,
      "voucher_from_seller": 0,
      "voucher_from_shopee": 50000,
      "seller_voucher_code": [
        "SVIPDDV0109M50C100"
      ],
      "buyer_total_amount": 225600,
      "commission_fee": 48506,
      "service_fee": 18158,
      "seller_transaction_fee": 16536,
      "credit_card_transaction_fee": 16536,
      "order_ams_commission_fee": 2436,
      "shipping_seller_protection_fee_amount": 2700,
      "actual_shipping_fee": 41000,
      "estimated_shipping_fee": 41000,
      "shopee_shipping_rebate": 41000,
      "buyer_paid_shipping_fee": 0,
      "reverse_shipping_fee": 0,
      "seller_return_refund": 0,
      "withholding_vat_tax": 0,
      "withholding_pit_tax": 0,
      "items": [
        {
          "item_id": 10000000077,
          "item_name": "Áo sơ mi nữ công sở cổ nơ",
          "item_sku": "WAKBD1016-WAKBE2040",
          "model_id": 10000000078,
          "model_name": "Trắng,L",
          "model_sku": "WAKBD1016-Màu 1-L",
          "quantity_purchased": 1,
          "original_price": 689000,
          "discounted_price": 275600,
          "selling_price": 275600,
          "seller_discount": 413400,
          "discount_from_voucher_shopee": 50000,
          "ams_commission_fee": 2436,
          "promotion_list": [
            {
              "promotion_id": 10000000079,
              "promotion_type": "platform_sale"
            }
          ]
        }
      ]
    },
    "buyer_payment_info": {
      "buyer_payment_method": "ShopeePay Linked Bank Account",
      "buyer_total_amount": 225600,
      "merchant_subtotal": 275600,
      "shopee_voucher": -50000,
      "seller_voucher": 0,
      "shipping_fee": 0
    }
  }
}

Mã lỗi của Shopee (11)

Bấm để xem
MãÝ nghĩa
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.
order_not_foundOrder SN provided is invalid or does not belong to you. Please enter a valid Order SN.
common.error_not_foundKhông tìm thấy thông tin.
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.

Bắt đầu dùng

  1. Đăng ký tài khoản Partner
  2. Mở loại dữ liệu thuộc nhóm Tài chính / đối soát ở trang nền tảng
  3. Tạo API key (tick kênh Shopee)
  4. Gọi theo ví dụ ở trên