Overview
This node integrates with the KiotViet invoicing system to manage invoices. It supports operations such as creating new invoices, retrieving invoices by ID or code, updating existing invoices, deleting invoices, and fetching multiple invoices with filtering options.
Common scenarios where this node is useful include:
- Automating invoice creation after a sale.
- Retrieving invoice details for reporting or auditing.
- Updating invoice information based on changes in orders.
- Deleting invoices that were created in error.
- Fetching lists of invoices filtered by date, status, branch, or pagination settings.
For example, a retail business could use this node to automatically create an invoice when a customer completes a purchase, then later retrieve all completed invoices within a date range for accounting purposes.
Properties
| Name | Meaning |
|---|---|
| Trả Về Tất Cả | Boolean option to return all results or limit the number of returned invoices. |
| Giới Hạn | Maximum number of invoices to return (used if not returning all). |
| Bộ Lọc | Collection of filters to narrow down the list of invoices: |
| - Trang | Number of results per page. |
| - Số Trang | Current page number. |
| - ID Chi Nhánh | Filter invoices by branch ID. |
| - Từ Ngày | Filter invoices from this date (format YYYY-MM-DD). |
| - ĐếN Ngày | Filter invoices up to this date (format YYYY-MM-DD). |
| - Trạng Thái | Filter invoices by status; options are: Nháp (Draft), Đang Xử Lý (Processing), Hoàn Thành (Completed), Đã Hủy (Cancelled). |
Output
The node outputs JSON data representing invoice information depending on the operation:
For Get Many (
getAll), it returns an object containing:data: An array of invoice objects matching the filters.total: Total number of invoices available.pageSize: Number of invoices per page.currentPage: The current page number.
For other operations like
create,get,getByCode,update, it returns the corresponding invoice object or confirmation message.For the
deleteoperation, it returns a success flag and a message confirming deletion.
The node does not output binary data.
Dependencies
- Requires an API key credential for authenticating with the KiotViet API.
- Uses the KiotViet API client internally to perform requests.
- No additional environment variables are explicitly required beyond the API credential.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication failures.
- Providing invalid invoice IDs or codes will result in errors when fetching or updating.
- Attempting unsupported operations (e.g., update or delete if not supported by the API) will throw errors.
- Pagination parameters must be valid numbers; otherwise, the API may reject the request.
Error messages:
"Update operation is not supported by the KiotViet API": Occurs if the API client does not support updating invoices. Verify API capabilities."Delete operation is not supported by the KiotViet API": Similar to above but for deletion.- Network or authentication errors typically indicate issues with the API key or connectivity.
To resolve errors:
- Ensure the API key credential is correctly configured.
- Validate input parameters before running the node.
- Check the KiotViet API documentation for supported operations and parameter formats.
Links and References
- KiotViet Official API Documentation
- n8n Documentation on Creating Custom Nodes