Square icon

Square

Consume Square API

Overview

This node integrates with the Square API to update an existing invoice. It allows users to modify various invoice details such as description, invoice number, title, and payment requests. This operation is useful in scenarios where invoice information needs correction or updating after creation, for example, changing due dates, enabling tipping on payment requests, or updating invoice metadata.

Practical examples:

  • Updating the description or title of an invoice to reflect new information.
  • Modifying payment request details like due dates or enabling tipping options.
  • Changing the invoice number to match internal accounting systems.

Properties

Name Meaning
Invoice ID The unique identifier of the invoice to update.
Version The current version number of the invoice; required to ensure concurrency control during update.
Update Fields Collection of fields to update on the invoice:
   Description Text description of the invoice.
   Invoice Number Custom invoice number string.
   Title Title of the invoice.
   Payment Requests One or more payment requests associated with the invoice. Each includes:
      Request Type Type of payment request (currently only "Balance" supported).
      Due Date Due date for the payment request.
      Tipping Enabled Boolean flag to enable or disable tipping on this payment request.

Output

The output is a JSON object representing the updated invoice as returned by the Square API. It contains all invoice details including any changes made during the update operation.

If multiple input items are processed, the output will be an array of such JSON objects, each corresponding to one updated invoice.

No binary data is produced by this node.

Dependencies

  • Requires an active connection to the Square API via an API key credential configured in n8n.
  • The node uses the Square API endpoint /invoices/{invoiceId} with HTTP PUT method to perform updates.
  • The environment can be set to either production or sandbox mode, affecting the base URL used for API calls.

Troubleshooting

  • Error: "Please enter at least one field to update for the invoice"
    Occurs if no update fields are provided. Ensure that at least one property under "Update Fields" is set before executing the node.

  • Version Mismatch Errors
    The Square API requires the correct invoice version number to prevent conflicting updates. Make sure to provide the current version of the invoice when updating.

  • Invalid Invoice ID
    If the invoice ID does not exist or is malformed, the API will return an error. Verify the invoice ID is correct.

  • API Authentication Errors
    Ensure the API key credential is valid and has appropriate permissions to update invoices.

  • Continue On Fail Behavior
    If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output JSON.

Links and References

Discussion