Receipts
Enables querying, inserting, and updating receipts for a Xero organization. Receipts confirm that payments have been made, and they help track money received by the organization.
Table Specific Information
The Receipts table allows you to SELECT, INSERT, UPDATE, and DELETE receipt line items for a Xero organization. The Id column is generated by the add-in; it combines the index of the line item with the unique, Xero-generated ReceiptId.
Note that this table only includes draft receipts - to retrieve receipts that have already been claimed, you will need to read from the ExpenseClaimReceipts view.
SELECT
The Xero API allows extensive filtering and ordering. You can define WHERE and ORDER BY clauses in a query to filter and order the results using any non-line-item column.
Note: The Xero API does not support filtering on line items or journal lines.
INSERT
To insert a single row, set the required fields. A new table object is created as a single entry. To insert a receipt record, the following fields are required in addition to at least one line item: Date, Contact_Name, and User_UserId. To add a new line item, the following fields are required: LineItem_Description, LineItem_UnitAmount, and LineItem_AccountCode.
In addition to inserting a single row, line item tables offer two additional ways to insert into a table.
- You can insert a new object with multiple line items using XML aggregates.
The elements supported here are the same as the LineItem columns without the "LineItem_" prefix, except when assigning tracking categories. Please refer to the
Xero documentation of the Receipts API for more details.
INSERT INTO Receipts (Date, Contact_Name, User_UserId, LineItemAggregate) VALUES ( '4/19/2006 9:16:48 AM', 'John Doe', 'c81045b2-5740-4aea-bf8a-3956941af387', '<LineItem> <Description>Coffee with client</Description> <UnitAmount>13.00</UnitAmount> <AccountCode>200</AccountCode> </LineItem> <LineItem> <Description>Bagel</Description> <UnitAmount>2.00</UnitAmount> <AccountCode>200</AccountCode> </LineItem>' )
- You can also insert a new line item on an existing object by specifying the Xero-generated value of the existing record. For example, to add a line item to an existing invoice:
INSERT INTO Receipts (ReceiptId, LineItem_Description, LineItem_UnitAmount) VALUES ('XXXXX-XXXXX-XXXXX-XXXXX', 'Coffee with client', 13.80)
Note: Inserting into existing records will count as two operations against the Xero API. One is required to retrieve the existing record, and another to update the record with new data.
UPDATE
You can update any field that is not read-only.
Note: UPDATE operations will count as two operations against the Xero API. One is required to retrieve the existing record, and another to update the record with new data.
DELETE
The Xero API has limited support for deleting any object. In order to delete objects, you must update their Status to an appropriate value.
Applicable values for this field may be state-dependent. For example, invoices can only have their status set to DELETED when the invoice status is currently DRAFT or SUBMITTED.
Columns
| Name | Type | ReadOnly | Description |
| Id [KEY] | String | True |
A combination of the line item index and the unique Xero-generated identifier for the receipt. |
| ReceiptId | String | False |
The unique Xero-generated identifier for the receipt, linking it to the transaction. |
| Date | Date | False |
The date when the receipt was issued or created. |
| Contact_ContactId | String | False |
The unique identifier for the contact associated with the receipt. A contact must be specified when creating a receipt. |
| Contact_Name | String | False |
The name of the contact associated with the receipt, typically the customer or company. |
| LineItem_Description | String | False |
A description for the item or service in the receipt. This field must contain at least one character and is required to create an approved receipt. |
| LineItem_UnitAmount | Decimal | False |
The unit price for the item or service listed on the receipt. |
| LineItem_AccountCode | String | False |
The account code associated with the receipt item. This must be an active account for the organisation. |
| LineItem_Quantity | Double | False |
The quantity of the item or service being purchased. This value must be zero or positive. |
| LineItem_TaxType | String | False |
The tax type applied to the item. This field can be used to override the default tax code for the selected account. |
| LineItem_LineAmount | Decimal | False |
The total amount for the line item, calculated by multiplying 'Quantity' by 'UnitAmount', including applicable discounts. |
| LineItem_TrackingCategory1_CategoryId | String | False |
The ID of a tracking category used to classify the line item. Two tracking categories can be defined for each item. |
| LineItem_TrackingCategory1_CategoryName | String | False |
The name of the tracking category associated with the line item. |
| LineItem_TrackingCategory1_OptionId | String | False |
The ID of the specific option within the tracking category. |
| LineItem_TrackingCategory1_OptionName | String | False |
The name of the tracking category option for the line item. |
| LineItem_TrackingCategory1_Option_Stat | String | False |
The status of the tracking category option. Defines the current state of the option. |
| LineItem_TrackingCategory2_CategoryId | String | False |
The ID of a second tracking category, if applicable, for the line item. |
| LineItem_TrackingCategory2_CategoryName | String | False |
The name of the second tracking category, if defined. |
| LineItem_TrackingCategory2_OptionId | String | False |
The ID of the second tracking category option. |
| LineItem_TrackingCategory2_OptionName | String | False |
The name of the second tracking category option. |
| LineItem_TrackingCategory2_Option_Stat | String | False |
The status of the second tracking category option. |
| LineItem_DiscountRate | Double | False |
The discount rate applied to the line item, expressed as a percentage. |
| LineItemAggregate | String | False |
Used to define multiple LineItem rows in XML format. Should only be provided during an INSERT operation. |
| User_UserId | String | False |
The ID of the user within the organisation that the expense claim receipt is associated with. |
| Reference | String | False |
An additional reference number to help identify the receipt or tie it to an external reference. |
| LineAmountTypes | String | False |
Specifies whether line amounts include tax. Valid values are 'Exclusive', 'Inclusive', and 'NoTax'. |
| SubTotal | Decimal | False |
The total value of the receipt, excluding taxes and discounts. |
| TotalTax | Decimal | False |
The total amount of tax applied to the receipt based on applicable rates. |
| Total | Decimal | False |
The total amount for the receipt, including both the subtotal and the total tax. |
| Status | String | True |
The current status of the receipt. Valid values are 'DRAFT', 'SUBMITTED', 'AUTHORISED', and 'DECLINED'. |
| ReceiptNumber | String | True |
The Xero-generated number identifying the receipt in the current sequence for the given user. |
| UpdatedDateUTC | Datetime | True |
The date and time when the receipt was last updated in the system. |
| HasAttachments | Boolean | True |
Indicates whether the receipt has any attachments linked to it. |
| URL | String | True |
A link to a source document associated with the receipt for reference. |
| TenantId | String | False |
The ID of the tenant to query, used when querying multiple tenants instead of the connection tenant. |