Hóa Đơn KiotViet icon

Hóa Đơn KiotViet

Quản lý hóa đơn từ KiotViet

Overview

This node manages invoices in the KiotViet system, allowing users to create, retrieve, update, and delete invoices. It is useful for automating invoice handling workflows such as updating invoice details after a sale, fetching invoice information for reporting, or removing obsolete invoices.

Practical examples include:

  • Automatically updating an existing invoice with new product details or payment information.
  • Retrieving invoice data by ID or code to integrate with other systems.
  • Creating new invoices based on order data from an e-commerce platform.
  • Deleting invoices that were created in error or are no longer needed.

Properties

Name Meaning
ID Hóa Đơn The unique identifier of the invoice to get, update, or delete.
Sản Phẩm Trong Hóa Đơn A list of products included in the invoice. Each product includes: ID Sản Phẩm (product ID), Mã Sản Phẩm (product code), Tên Sản Phẩm (product name), Số Lượng (quantity), Giá Bán (price), Giảm Giá (discount amount), Tỷ Lệ Giảm Giá (%) (discount percentage), Ghi Chú (note), and Số Serial (serial numbers). Used when creating or updating an invoice.
Trường Bổ Sung Additional fields for the invoice including: Tổng Thanh Toán (total payment, required), ID Khách Hàng (customer ID), Ngày Mua Hàng (purchase date in YYYY-MM-DD), Giảm Giá (total discount), Phương Thức Thanh Toán (payment method: Tiền Mặt, Thẻ, Chuyển Khoản, Thanh Toán Di Động, Kết Hợp), ID Tài Khoản (bank account ID, required for Card/BankTransfer), Sử Dụng COD (use COD payment), ID Nhân Viên Bán (salesperson ID), ID Đơn Hàng (related order ID), ID Kênh Bán (sales channel ID), Áp Dụng Voucher (whether voucher applied). Used when creating or updating an invoice.

Output

The node outputs JSON data representing the invoice(s) returned or affected by the operation:

  • For create and update operations, it returns the full invoice object as stored in KiotViet, including updated product lists and additional fields.
  • For get and getByCode, it returns the invoice object matching the specified ID or code.
  • For getAll, it returns a paginated list of invoices with metadata such as total count, page size, and current page.
  • For delete, it returns a success message confirming deletion.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential for authenticating with the KiotViet API.
  • The node depends on the KiotViet API service being accessible and properly configured.
  • No additional environment variables are explicitly required beyond the API credential.

Troubleshooting

  • Common issues:

    • Missing or invalid invoice ID when performing get, update, or delete operations will cause errors.
    • Providing incomplete product details (e.g., missing required fields like productId or productCode) during create or update may result in API validation errors.
    • Using payment methods that require an account ID without providing one will cause failures.
    • Network or authentication errors if the API key is invalid or the KiotViet service is unreachable.
  • Error messages and resolutions:

    • "Update operation is not supported by the KiotViet API" or "Delete operation is not supported by the KiotViet API": This indicates the API client does not support these operations; ensure you have the latest node version or check API permissions.
    • Validation errors about missing required fields: Verify all mandatory properties are set correctly.
    • API authentication errors: Check that the API key credential is valid and has necessary permissions.
    • Pagination issues when retrieving many invoices: Adjust returnAll and limit parameters appropriately.

Links and References

Discussion