Automation Action: Xero Invoice
Within the Xero Invoice action, the following functionality is available:
- Create Invoice
- Update Invoice
- Get Invoice URL
This document will document how to successully use them, including any enum values you may need and other information such at formatting rules.
Create Invoice
When creating an invoice, the following fields are required as a minimum.
- InvoiceType
- Date
- At least 1 invoice item
- An invoice item should include a Description, Quantity & UnitAmount as a minimum
If only the minimum amount of fields are provided, then the invoice will sit in a "draft" state until it gets updated with the full information.
Whilst an invoice is in a "draft" state, actions such as fetching a URL will not work.
Create Invoice Enums & Codes
- Status: DRAFT (default if not provided), SUBMITTED, AUTHORISED. For more information see here
- InvoiceType: ACCPAY, ACCREC. For more information see here
- ItemCode: item codes are unique to your Xero account and can be found here
- AccountCode: account codes are unique to your Xero account and can be found here
Update Invoice
Updating invoices follows a very similar procedure to the "Create Invoice" operation. The only difference between the two is that an Invoice ID will be required to update an invoice. Failure to provide a Invoice ID may result in new invoices being created.
Update Invoice Enums & Codes
- Status: DRAFT (default if not provided), SUBMITTED, DELETED, AUTHORISED, PAID, VOIDED. For more information see here. These statuses can only be applied in specific orders, so it is recommened you review the documentation provided by Xero here.
- InvoiceType: ACCPAY, ACCREC. For more information see here
- ItemCode: item codes are unique to your Xero account and can be found here
- AccountCode: account codes are unique to your Xero account and can be found here
Get Invoice URL
When fetching an invoice URL, the only information required is an invoice ID. There is also an optional checkbox to fetch a URL to the PDF version. The PDF URL can then be used with the ThinkAutomation "Download File" action, to save the the file locally.
Formatting
Dates
When providing any dates for invoices, they must be in the following format: YYYY-MM-DD. Failure to provide dates in this format may lead to errors when creating invoices, or inaccurate dates being used.
Errors
If an error occurs during any process, the response returned will be an empty string and any errors added to the automation log.
Additional Help
Authorizing an invoice
If you wish to mark an invoice as authorized, the following data is required:
- Date (the date the invoice was issued)
- DueDate
- ExpectedPaymentDate
- PlannedPaymentDate
- Completed invoice items including:
- Description
- Quantity
- UnitAmount
- AccountCode