Create Invoice

Create a new invoice.

Request

Field Type Description  
invoice dateCreated string The tax point of the invoice required
invoice dateDue string The date the invoice is due (YYYY-MM-DD). Use either this field or creditTerms required
invoice dateAccrual string The invoice accrual date optional
invoice creditTerms string The number of days after the tax point that the invoice is due required
invoice description string optional
invoice entityId string The customer or supplier id required
invoice reference string A reference string for the invoice optional
invoice project string The id of the project to assign the invoice to optional
invoice type string A string identifying the type of the invoice Value one of: purchases sales cn-sales cn-purchases optional
items string A list of item elements identifying the line items required
item description string required
item unitPrice string The unit price of an item in pounds required
item quantity string required
item type string The account code identifying the revenue stream required
item vat string The total amount of VAT in pounds. Use either this field or vatRate. required
item vatRate string The percentage VAT as a decimal number. Use either this field or vat. required
invoice bankPaymentId integer The bank account code optional

Response

Field Type Description  
due float The total amount due in pounds optional
invoice_id integer The internal id of the invoice optional
invoice_prefix string The prefix of the invoice optional
invoice_number string The number of the invoice optional

Examples

Request

<?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>