Sapo Đơn Hàng icon

Sapo Đơn Hàng

Quản lý đơn hàng trên Sapo

Overview

This node integrates with the Sapo e-commerce platform to manage orders. It supports various operations such as creating, retrieving, updating, deleting, canceling orders, and marking them as paid or fulfilled. This node is useful for automating order management workflows, syncing order data between Sapo and other systems, or performing bulk updates on orders.

For example, you can use this node to:

  • Update an existing order's details after receiving new customer information.
  • Cancel an order automatically if payment is not received within a certain timeframe.
  • Mark orders as fulfilled once they have been shipped.

Properties

Name Meaning
Operation The action to perform on the order. Options: Cancel, Count, Create, Delete, Get, Get Many, Mark Fulfilled, Mark Paid, Update
Order ID The unique numeric identifier of the order to operate on. Required for operations like get, update, delete, cancel, mark as paid, and mark as fulfilled
Dữ Liệu (Data) JSON object containing the data to send to Sapo when creating or updating an order. Required for create and update operations
Trả Về Tất Cả (Return All) Boolean indicating whether to return all results or limit the number of results when listing multiple orders (Get Many operation)
Giới Hạn (Limit) Maximum number of results to return when Return All is false (Get Many operation)
Thông Tin Bổ Sung (Additional Fields) Additional optional filters for listing orders, including:
- Created After (dateTime)
- Created Before (dateTime)
- Status (Open, Closed, Cancelled)
- Financial Status (Authorized, Paid, Partially Paid, Pending, Refunded, Voided)
- Fulfillment Status (Fulfilled, Partial, Unfulfilled)

Output

The node outputs an array with one item containing a json field. The structure of the json output depends on the operation performed:

  • For create, get, update, cancel, markAsPaid, markAsFulfilled: The output contains the order object returned by Sapo API reflecting the current state of the order.
  • For delete: The output contains { success: true } indicating successful deletion.
  • For count: The output contains { count: <number> } representing the total number of orders.
  • For getMany: The output contains a list of orders matching the specified filters and limits.

The node does not output binary data.

Dependencies

  • Requires an active connection to the Sapo API via an API key credential configured in n8n.
  • Uses the internal SapoApiBase helper class to interact with the Sapo orders endpoint.

Troubleshooting

  • Common issues:

    • Invalid or missing Order ID for operations that require it (get, update, delete, etc.) will cause errors.
    • Malformed JSON in the "Dữ Liệu" property for create/update operations may result in API errors.
    • Insufficient permissions or invalid API credentials will cause authentication failures.
    • Using filters in "Additional Fields" incorrectly (e.g., invalid date formats) may lead to empty results or errors.
  • Error messages:

    • Errors from the Sapo API are caught and either thrown or returned as error objects depending on the node’s "Continue On Fail" setting.
    • Typical error messages include "Order not found", "Invalid data format", or authentication errors.
  • Resolution tips:

    • Verify that the Order ID exists and is correct.
    • Ensure JSON data is valid and matches Sapo API expectations.
    • Check API credentials and permissions.
    • Use proper date/time formats for filtering.

Links and References

Discussion