PUT /api.xro/1.0/invoice
Inserts an invoice for a specific organization in Xero. (Currently only adding new invoices is allowed).
Request
| Parameter | Description |
| apiKey(Required) | Your partner API Key. |
| xeroKey(Required) | The Xero Customer Key generated by the Xero customer and provided to you to access their organisation data. |
Example
To insert an invoice perform the following HTTP request.
<Invoice> <InvoiceType>ACCREC</InvoiceType> <Contact> <Name>Red House Reads</Name> <EmailAddress>accounts@redhousereads.co.nz</EmailAddress> <Addresses> <Address> <AddressType>POBOX</AddressType> <AddressLine1>Lvl 1</AddressLine1> <AddressLine2>Herd St Building</AddressLine2> <AddressLine3>Herd St</AddressLine3> <AddressLine4>Wellington</AddressLine4> <City>Wellington</City> <Region>Wellington</Region> <PostalCode>6011</PostalCode> <Country>New Zealand</Country> </Address> </Addresses> <Phones> <Phone> <PhoneType>DDI</PhoneType> <PhoneNumber>1234567</PhoneNumber> <PhoneAreaCode>4</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> <Phone> <PhoneType>DEFAULT</PhoneType> <PhoneNumber>1234567</PhoneNumber> <PhoneAreaCode>4</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> <Phone> <PhoneType>MOBILE</PhoneType> <PhoneNumber>123123</PhoneNumber> <PhoneAreaCode>21</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> <Phone> <PhoneType>FAX</PhoneType> <PhoneNumber>1234568</PhoneNumber> <PhoneAreaCode>4</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> </Phones> </Contact> <InvoiceDate>2008-02-25T00:00:00</InvoiceDate> <DueDate>2008-02-15T00:00:00</DueDate> <InvoiceNumber>OIT00535</InvoiceNumber> <Reference></Reference> <IncludesTax>true</IncludesTax> <SubTotal>379.53</SubTotal> <TotalTax>47.44</TotalTax> <Total>426.97</Total> <LineItems> <LineItem> <Description>Copies of Windows for Mother</Description> <Quantity>10.0000</Quantity> <UnitAmount>39.95</UnitAmount> <TaxType>OUTPUT</TaxType> <TaxAmount>49.94</TaxAmount> <LineAmount>399.50</LineAmount> <AccountCode>200</AccountCode> <Tracking> <TrackingCategory> <Name>Activity/Workstream</Name> <Option>Publications</Option> </TrackingCategory> </Tracking> </LineItem> <LineItem> <Description>Discount on order of 10</Description> <Quantity>1.0000</Quantity> <UnitAmount>-19.97</UnitAmount> <TaxType>OUTPUT</TaxType> <TaxAmount>-2.50</TaxAmount> <LineAmount>-19.97</LineAmount> <AccountCode>200</AccountCode> <Tracking> <TrackingCategory> <Name>Activity/Workstream</Name> <Option>Publications</Option> </TrackingCategory> </Tracking> </LineItem> </LineItems> </Invoice>
This will respond with the following XML document describing the invoice:
<Invoice> <InvoiceType>ACCREC</InvoiceType> <Contact> <Name>Red House Reads</Name> <EmailAddress>accounts@redhousereads.co.nz</EmailAddress> <Addresses> <Address> <AddressType>POBOX</AddressType> <AddressLine1>Lvl 1</AddressLine1> <AddressLine2>Herd St Building</AddressLine2> <AddressLine3>Herd St</AddressLine3> <AddressLine4>Wellington</AddressLine4> <City>Wellington</City> <Region>Wellington</Region> <PostalCode>6011</PostalCode> <Country>New Zealand</Country> </Address> </Addresses> <Phones> <Phone> <PhoneType>DDI</PhoneType> <PhoneNumber>1234567</PhoneNumber> <PhoneAreaCode>4</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> <Phone> <PhoneType>DEFAULT</PhoneType> <PhoneNumber>1234567</PhoneNumber> <PhoneAreaCode>4</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> <Phone> <PhoneType>MOBILE</PhoneType> <PhoneNumber>123123</PhoneNumber> <PhoneAreaCode>21</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> <Phone> <PhoneType>FAX</PhoneType> <PhoneNumber>1234568</PhoneNumber> <PhoneAreaCode>4</PhoneAreaCode> <PhoneCountryCode>64</PhoneCountryCode> </Phone> </Phones> </Contact> <InvoiceDate>2008-02-25T00:00:00</InvoiceDate> <DueDate>2008-02-15T00:00:00</DueDate> <InvoiceNumber>OIT00535</InvoiceNumber> <Reference></Reference> <IncludesTax>true</IncludesTax> <SubTotal>379.53</SubTotal> <TotalTax>47.44</TotalTax> <Total>426.97</Total> <LineItems> <LineItem> <Description>Copies of Windows for Mother</Description> <Quantity>10.0000</Quantity> <UnitAmount>39.95</UnitAmount> <TaxType>OUTPUT</TaxType> <TaxAmount>49.94</TaxAmount> <LineAmount>399.50</LineAmount> <AccountCode>200</AccountCode> <Tracking> <TrackingCategory> <Name>Activity/Workstream</Name> <Option>Publications</Option> </TrackingCategory> </Tracking> </LineItem> <LineItem> <Description>Discount on order of 10</Description> <Quantity>1.0000</Quantity> <UnitAmount>-19.97</UnitAmount> <TaxType>OUTPUT</TaxType> <TaxAmount>-2.50</TaxAmount> <LineAmount>-19.97</LineAmount> <AccountCode>200</AccountCode> <Tracking> <TrackingCategory> <Name>Activity/Workstream</Name> <Option>Publications</Option> </TrackingCategory> </Tracking> </LineItem> </LineItems> </Invoice>Request Xml Schema
<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Invoice"> <xs:complexType> <xs:sequence> <xs:element name="InvoiceType" type="xs:string" /> <xs:element name="Contact"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="ContactID" type="xs:string" /> <xs:element name="Name" type="xs:string" /> <xs:element minOccurs="0" name="EmailAddress" type="xs:string" /> <xs:element name="Addresses"> <xs:complexType> <xs:sequence> <xs:element name="Address"> <xs:complexType> <xs:sequence> <xs:element name="AddressType" type="xs:string" /> <xs:element minOccurs="0" name="AddressLine1" type="xs:string" /> <xs:element minOccurs="0" name="AddressLine2" type="xs:string" /> <xs:element minOccurs="0" name="AddressLine3" type="xs:string" /> <xs:element minOccurs="0" name="AddressLine4" type="xs:string" /> <xs:element minOccurs="0" name="City" type="xs:string" /> <xs:element minOccurs="0" name="Region" type="xs:string" /> <xs:element minOccurs="0" name="PostalCode" type="xs:unsignedShort" /> <xs:element minOccurs="0" name="Country" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element minOccurs="0" name="Phones"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="Phone"> <xs:complexType> <xs:sequence> <xs:element name="PhoneType" type="xs:string" /> <xs:element minOccurs="0" name="PhoneNumber" type="xs:unsignedInt" /> <xs:element minOccurs="0" name="PhoneAreaCode" type="xs:unsignedByte" /> <xs:element minOccurs="0" name="PhoneCountryCode" type="xs:unsignedByte" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="InvoiceDate" type="xs:dateTime" /> <xs:element minOccurs="0" name="DueDate" type="xs:dateTime" /> <xs:element name="InvoiceNumber" type="xs:string" /> <xs:element minOccurs="0" name="Reference" type="xs:string" /> <xs:element minOccurs="0" name="IncludesTax" type="xs:boolean" /> <xs:element minOccurs="0" name="SubTotal" type="xs:decimal" /> <xs:element minOccurs="0" name="TotalTax" type="xs:decimal" /> <xs:element minOccurs="0" name="Total" type="xs:decimal" /> <xs:element name="LineItems"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="LineItem"> <xs:complexType> <xs:sequence> <xs:element name="Description" type="xs:string" /> <xs:element minOccurs="0" name="Quantity" type="xs:decimal" /> <xs:element name="UnitAmount" type="xs:decimal" /> <xs:element minOccurs="0" name="TaxType" type="xs:string" /> <xs:element name="TaxAmount" type="xs:decimal" /> <xs:element name="LineAmount" type="xs:decimal" /> <xs:element name="AccountCode" type="xs:string" /> <xs:element name="Tracking"> <xs:complexType> <xs:sequence> <xs:element name="TrackingCategory"> <xs:complexType> <xs:sequence> <xs:element name="Name" type="xs:string" /> <xs:element name="Option" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Response Xml Schema
See Invoice Response Xml Schema
[...] The invoices are sent to Xero using PUT Invoice [...]