Applies to: Invoices API
Learn how to add, change, or clear fields in an invoice using the Invoices API.
Applications can call the UpdateInvoice endpoint in the Invoices API to update an invoice. For example, you can add or update the title, change the payment schedule, and change accepted payment methods. This endpoint supports sparse updates.
Only invoices in the
DRAFT
,SCHEDULED
,UNPAID
, orPARTIALLY_PAID
state can be updated. You cannot update invoices in thePAID
,REFUNDED
,PARTIALLY_REFUNDED
,CANCELED
, orFAILED
terminal state.For invoices in the
PAYMENT_PENDING
state, you must wait for the payment to complete before you can update it (assuming it reaches thePARTIALLY_PAID
state). In addition, the seller or customer cannot initiate another payment for an invoice in this state.The following restrictions apply to updating an invoice in a
DRAFT
state:- You cannot update the
order_id
orlocation_id
field. - Updating the
primary_recipient
contact information requires two update requests. Use the first request to clear this field and the second request to add the field again.
- You cannot update the
The following restrictions apply to updating a published invoice in the
SCHEDULED
,UNPAID
, orPARTIALLY_PAID
state:- You cannot update the
order_id
orlocation_id
field. - You cannot update the
primary_recipient
field. For more information, see Limitations with the Customers API integration.
- You cannot update the
UpdateInvoice
cannot be used to upload or delete an invoice attachment. To manage attachments, use theCreateInvoiceAttachment
orDeleteInvoiceAttachment
endpoint. For more information, see Create or Delete Invoice Attachments.
To update an invoice, call UpdateInvoice and provide the following information:
The ID of the invoice to update.
An
invoice
object with:- The current
version
of the invoice. - Any new fields to add and existing fields to change or clear (remove).
To change fields, provide the updated values.
To clear fields, specify a
null
value.Updating
payment_requests
orreminders
uses a different syntax. To change a value, specify theuid
and provide the updated value. To clear an element, specify theuid
and include theremove
field set totrue
.The Invoices API also supports using the
fields_to_clear
field to clear fields. However, usingnull
values or theremove
field is the recommended field clearing method.
- The current
An optional
idempotency_key
to ensure idempotency.
Note
If you need to get the invoice ID and version, call SearchInvoices or ListInvoices. If you have the ID but need the version, call GetInvoice.
The following UpdateInvoice
request adds (or updates) the invoice_number
field and clears the description
field.
In the Invoice
object:
- Specify a value for
invoice_number
. - Set the
description
value tonull
.
Update invoice
For this example, Square adds the invoice_number
field if isn't already defined for the invoice; otherwise, Square updates its value.
After an invoice is updated, Square does the following:
Notifies the seller, if the Updated notification is enabled in the seller's notification settings.
Notifies the customer, as determined by the
delivery_method
setting for the invoice:EMAIL
- Square sends an email to the customer.SMS
- Square sends a text message to the customer unless the customer has opted out of text message updates from Square invoices.SHARE_MANUALLY
- Square doesn't notify the customer.
Opting out of sending
EMAIL
orSMS
notifications to customers isn't possible when updating an invoice with the Invoices API.Increments the invoice version.
Invokes an
invoice.updated
webhook event.
The following example UpdateInvoice
requests show various update scenarios:
- Update payment requests by removing the deposit request
- Remove and add payment requests
- Replace payment request percentages with exact amounts
- Update custom fields