Hóa Đơn KiotViet icon

Hóa Đơn KiotViet

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

Overview

This node integrates with the KiotViet platform to manage invoices. It supports creating new invoices, retrieving invoices by ID or code, listing multiple invoices with filters, updating existing invoices, and deleting invoices. This node is useful for automating invoice management workflows such as syncing sales data, updating invoice details, or cleaning up records in KiotViet.

Practical examples include:

  • Automatically creating an invoice in KiotViet when a sale is made on another platform.
  • Fetching detailed invoice information by its unique ID for reporting or auditing.
  • Updating invoice details like products or payment methods after a transaction correction.
  • Deleting obsolete or test invoices from KiotViet.

Properties

Name Meaning
operation The action to perform: create, get (get by ID), getByCode, getAll, update, delete.
invoiceId The unique identifier of the invoice (required for get, update, delete).
invoiceCode The code of the invoice (required for getByCode).
branchId Branch ID where the invoice is created (required for create).
returnAll Whether to return all invoices or limit the number of results (boolean, for getAll).
limit Maximum number of invoices to return (number, used if returnAll is false in getAll).
invoiceDetails List of products in the invoice, each with product ID, code, name, quantity, price, discount, discount ratio, note, and serial numbers (for create and update).
filters Filters for listing invoices (getAll), including page size, current page, branch ID, date range, and status.
additionalFields Additional optional fields for create and update operations, such as total payment, customer ID, purchase date, discount, payment method, account ID, COD usage, seller ID, order ID, sales channel ID, and voucher application flag.

Output

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

  • For get, getByCode, create, and update: a single invoice object with detailed properties as returned by the KiotViet API.
  • For getAll: an object containing an array of invoices under data, along with pagination info (total, pageSize, currentPage).
  • For delete: 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.
  • Uses the KiotViet API client implemented in the shared module.
  • Node expects proper configuration of the KiotViet API credentials within n8n.

Troubleshooting

  • Common issues:
    • Invalid or missing invoice ID or code when performing get, update, or delete operations will cause errors.
    • Attempting to update or delete when the API does not support these operations will throw an error.
    • Pagination parameters must be correctly set when using getAll to avoid empty or incomplete results.
  • Error messages:
    • "Update operation is not supported by the KiotViet API" or "Delete operation is not supported by the KiotViet API" indicate that the API client lacks these methods; check API version or permissions.
    • Errors related to authentication usually mean the API key credential is missing or invalid.
  • To resolve errors, verify input parameters, ensure correct API credentials, and confirm that the KiotViet API supports the requested operation.

Links and References

Discussion