Square icon

Square

Consume Square API

Order → Create

AI-generated

Overview

This node operation creates a new order in the Square system. It is useful for automating order creation workflows, such as when integrating e-commerce platforms or point-of-sale systems with Square. Users can specify the location for the order, provide detailed order information in JSON format (including line items, taxes, discounts, and service charges), and optionally include additional fields like idempotency key, customer ID, reference ID, and order state.

Use Case Examples

  1. Creating an order with multiple line items and taxes for a specific store location.
  2. Automatically generating an order for a returning customer by specifying the customer ID and order details.
  3. Using an idempotency key to ensure the order creation request is processed only once, preventing duplicate orders.

Properties

Name Meaning
Location ID The ID of the location to associate with the order. This is required to specify where the order is being placed.
Order Details (JSON) The order details provided as a JSON string. This can include line_items, taxes, discounts, service_charges, and other order-related information.
Additional Fields Optional additional fields to customize the order creation. Includes idempotency key to ensure the operation is applied once, customer ID to associate the order with a customer, reference ID for client-specified identification, and the state of the order (Open, Completed, Canceled, Draft).

Output

JSON

  • order
    • id - The unique identifier of the created order.
    • location_id - The location ID associated with the order.
    • customer_id - The customer ID associated with the order, if provided.
    • reference_id - The client-specified reference ID for the order, if provided.
    • state - The state of the order (e.g., OPEN, COMPLETED).
  • idempotency_key - The unique key used to ensure the operation is applied only once.

Dependencies

  • Square API with an API key credential for authentication

Troubleshooting

  • Invalid JSON in the 'Order Details (JSON)' field will cause an error. Ensure the JSON is correctly formatted.
  • Missing required 'Location ID' will cause the request to fail. Provide a valid location ID.
  • If the idempotency key is not unique or reused improperly, it may cause unexpected behavior or duplicate order prevention issues.
  • API errors from Square (e.g., invalid customer ID or invalid order state) will be returned and should be handled appropriately.

Links

Discussion