Square icon

Square

Consume Square API

Order → Update

AI-generated

Overview

This node updates an existing order in the Square system using the Square API. It is useful for scenarios where you need to modify order details such as line items, taxes, or other order attributes programmatically. For example, you can update an order's version, line items, or clear specific fields by providing the updates in JSON format.

Use Case Examples

  1. Updating an order's line items after a customer changes their order.
  2. Clearing specific fields like taxes from an order.
  3. Applying an idempotency key to ensure the update is applied only once.

Properties

Name Meaning
Order ID The ID of the order to update.
Order Updates (JSON) The order updates as JSON. This includes the fields to clear and the updated order details.
Additional Fields Optional additional fields for the update, such as an idempotency key to ensure the update is applied only once.

Output

JSON

  • order_id - The ID of the updated order.
  • order
    • version - The version number of the updated order.
    • line_items - The updated line items of the order.
    • fields_to_clear - Fields that were cleared during the update.

Dependencies

  • Square API with an API key credential for authentication.

Troubleshooting

  • Ensure the 'Order Updates (JSON)' field contains valid JSON; otherwise, a parsing error will occur.
  • If no fields are provided to update, the API may reject the request or no changes will be made.
  • Use a unique idempotency key to avoid duplicate updates if the request is retried.
  • Common error messages include JSON parsing errors and API errors returned by Square, which should be handled by checking the error message and correcting the input accordingly.

Links

Discussion