createInvoice
Create a new Invoice
Create a new invoice.
Request
| Field | Description | Additional info |
|---|---|---|
| invoice dateCreated | The tax point of the invoice | |
| invoice dateDue | The date the invoice is due (YYYY-MM-DD) | Use either this field or creditTerms |
| invoice creditTerms | The number of days after the tax point that the invoice is due | |
| invoice description | ||
| invoice entityId | The customer or supplier id | |
| invoice reference | A reference string for the invoice | |
| invoice project | The id of the project to assign the invoice to | Optional |
| invoice type | A string identifying the type of the invoice | Value one of:
|
| items | A list of item elements identifying the line items | |
| item description | ||
| item unitPrice | The unit price of an item in pounds | |
| item quantity | ||
| item type | The account code identifying the revenue stream | |
| item vat | The total amount of VAT in pounds | Use either this field or vatRate |
| item vatRate | The percentage VAT as a decimal number |
Response
| Field | Description | Additional info |
|---|---|---|
| due | The total amount due in pounds | |
| invoice_id | The internal id of the invoice | |
| invoice_prefix | The prefix of the invoice | |
| invoice_number | The number of the invoice |
Example
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cb="https://secure.clearbooks.co.uk/api/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <env:Header> <cb:authenticate apiKey="yourApiKey" /> </env:Header> <env:Body> <env:createInvoice env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <invoice entityId="2" invoice_prefix="PRE" invoice_number="00001" reference="trdfffffggt" dateCreated="2008-09-17" dateDue="2008-10-17" project="1" type="purchases" xsi:type="cb:Invoice"> <items enc:itemType="cb:Item" xsi:type="cb:ArrayOfItem"> <item unitPrice="1.44" quantity="1" type="1001001" vatRate="0.175" xsi:type="cb:Item" /> </items> <description xsi:type="xsd:string">My invoice</description> </invoice> </env:createInvoice> </env:Body> </env:Envelope>
Response
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cb="https://secure.clearbooks.co.uk/api/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"> <env:createInvoiceResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <createInvoiceReturn due="1.66" invoice_id="12" invoice_prefix="PRE" invoice_number="1" xsi:type="cb:InvoiceReturn" /> </env:createInvoiceResponse> </env:Body> </env:Envelope>