Features
Pricing
Support
Accountants
MTD Software
Contact
More
Log in
 

Soap API documentation

Method: createPayment

Create a new Payment.

Request

Field Type Description  
payment accountingDate string Date the payment was made optional
payment type string String identifying the type of the payment. Value one of: purchases, sales required
payment description string required
payment amount float The total amount paid in pounds required
payment entityId integer The id of the customer or supplier required
payment paymentMethod integer The id of the payment method. Please take a look at the listPaymentMethods method to grab a list of valid payment method IDs. required
payment bankAccount string The account code of the bank account being paid into required
invoices[ ] array An array of invoice elements optional
invoices[ ][id] integer The internal id of the invoice required
invoices[ ][amount] float The amount to pay the invoice off by. Optional, if not specified, will try to allocate as much of the amount as possible optional
fxRate float The exchange rate from the home currency to the bank account currency. optional

Response

Field Type Description  
payment_id integer The internal id of the payment optional

Examples

Request

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:cb="https://secure.clearbooks.co.uk/api/soap/"
  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:createPayment env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
      <payment
        type="purchases"
        project="1"
        accountingDate="2008-09-17"
        amount="1"
        entityId="1"
        paymentMethod="5"
        bankAccount="7502001"
        fxRate="0.12"
        xsi:type="cb:Payment">
        <description xsi:type="xsd:string">My Payment</description>
        <invoices enc:itemType="cb:PaymentInvoice"
          xsi:type="cb:ArrayOfPaymentInvoice">
          <invoice id="167" xsi:type="cb:PaymentInvoice" />
        </invoices>
      </payment>
    </env:createPayment>
  </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:createPaymentResponse
      env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
      <createPaymentReturn
        payment_id="25"
        xsi:type="cb:PaymentReturn" />
    </env:createPaymentResponse>
  </env:Body>
</env:Envelope>