API lấy chi tiết hóa đơn

Lấy thông tin chi tiết hóa đơn điện tử theo mã tham chiếu qua SePay eInvoice API. Trả về thông tin người mua, danh mục hàng, thuế và trạng thái hóa đơn.

||

API Endpoint

GET
https://einvoice-api.sepay.vn/v1/invoices/{reference_code}

API Request

reference_codestringrequired

Mã tham chiếu hóa đơn

Lấy reference_code từ đâu?

reference_code là mã tham chiếu duy nhất của hóa đơn, bạn có thể lấy từ:

  • API Xuất hóa đơn - Trả về trong response khi kiểm tra trạng thái xuất hóa đơn (/v1/invoices/create/check/{tracking_code})
  • API Phát hành hóa đơn - Trả về trong response khi kiểm tra trạng thái phát hành (/v1/invoices/issue/check/{tracking_code})
  • API Danh sách hóa đơn - Mỗi hóa đơn trong danh sách đều có reference_code (/v1/invoices)

API Response

Response thành công (200)
{
  "success": true,
  "data": {
    "reference_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "invoice_number": "589",
    "issued_date": "2026-01-26",
    "pdf_url": "https://beta-portalv2.mifi.vn/DownloadPDFCA.aspx?...",
    "xml_url": null,
    "status": "issued",
    "buyer": {
      "name": "Công ty ABC",
      "tax_code": "0101234567",
      "address": "123 Đường A, Quận B, Hà Nội",
      "email": "buyer@example.com",
      "phone": "0900000000"
    },
    "total_before_tax": 200000,
    "tax_amount": 20000,
    "total_amount": 220000,
    "notes": "Ghi chú hóa đơn",
    "source": "api",
    "items": [
      {
        "line_number": 1,
        "line_type": 1,
        "item_code": "SP001",
        "item_name": "Sản phẩm A",
        "unit": "cái",
        "quantity": "2.00",
        "unit_price": "100000.00",
        "total_amount": "200000.00",
        "tax_rate": "10.00",
        "tax_amount": "20000.00"
      }
    ]
  }
}
successboolean
dataobject

Xử lý lỗi

401Unauthorized

Thiếu hoặc sai Bearer token. Kiểm tra lại header Authorization.

404Not Found

Không tìm thấy hóa đơn theo reference_code. Kiểm tra lại mã tham chiếu.

Code mẫu

>
>
>
curl --request GET \
--url https://einvoice-api.sepay.vn/v1/invoices/084e179d-d95a-11f0-aef4-52c7e9b4f41b \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN'

Bước tiếp theo

Sau khi có thông tin chi tiết hóa đơn:

  1. Tải hóa đơn - Sử dụng reference_code để tải file PDF hoặc XML của hóa đơn
  2. Danh sách hóa đơn - Quay lại danh sách để tra cứu các hóa đơn khác