Sage Accounting Purchase Invoice XML
Tasks
- Export Purchase Invoices from Sage Business Cloud Accounting
- Import Purchase Invoices to Sage Business Cloud Accounting
XML
Any Sage Accounting fields not documented below are not supported with our uploads.
A complete example of the XML is shown below. This represents the minimum information required to create a purchase invoice record in Sage Accounting:
<?xml version="1.0" encoding="utf-8"?>
<sage_one_company
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<purchase_invoices>
<purchase_invoice>
<contact>
<reference>ZYNK0001</reference>
</contact>
<due_date>2024-01-31</due_date>
<main_address>
<address_line_1>Zynk Software</address_line_1>
<address_line_2>6-8 Charlotte Square</address_line_2>
<city>Newcastle upon Tyne</city>
<region>Tyne & Wear</region>
<postal_code>NE1 4XF</postal_code>
<country>
<id>GB</id>
</country>
</main_address>
<invoice_lines>
<invoice_line>
<description>Free text item</description>
<ledger_account>
<nominal_code>5000</nominal_code>
</ledger_account>
<quantity>1</quantity>
<unit_price>10</unit_price>
<tax_rate>
<id>GB_STANDARD</id>
</tax_rate>
</invoice_line>
</invoice_lines>
</purchase_invoice>
</purchase_invoices>
</sage_one_company>
Invoice Identification
The following fields are use to identify the purchase invoice to create/update. If neither are provided, a new invoice will always be created.
Sage Field | XML Field | Example | Field Type | Input | Notes |
---|---|---|---|---|---|
- | id | be4eca91e41411e7aa730a57719b2edb | GUID | Optional | Sage's unique invoice ID. |
- | external_id | inv-0001 | string | Optional | The ID of this record from the source data. Will be stored in Zynk's truth table. |
<?xml version="1.0" encoding="utf-8"?>
<sage_one_company
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<purchase_invoices>
<purchase_invoice>
<id>be4eca91e41411e7aa730a57719b2edb</id>
<external_id>inv-0001</external_id>
</purchase_invoice>
</purchase_invoices>
</sage_one_company>
Supplier Selection
Each invoice must be assigned to an existing supplier in Sage. At least one of following fields must be provided to identify the supplier to assign the invoice to. If more than one is provided, Zynk will look for a match based on each field in turn, in the order they are listed below.
Sage Field | XML Field | Example | Field Type | Input | Notes |
---|---|---|---|---|---|
Reference | contact/reference | ZYNK0001 | string | Optional | |
- | contact/id | 8a9b4b1f174c11e691e20a5d7cf84c3e | GUID | Optional | Sage's unique supplier ID. |
- | contact/external_id | 1234567 | string | Optional | The ID of the supplier from the source data. Will only work if the supplier was imported into Sage via Zynk, and the same external_id was provided. |
Company / Name | contact/name | Zynk Software | string | Optional | |
Main Contact > Email | contact/email | [email protected] | string | Optional |
<?xml version="1.0" encoding="utf-8"?>
<sage_one_company
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<purchase_invoices>
<purchase_invoice>
<contact>
<reference>ZYNK0001</reference>
<id>8a9b4b1f174c11e691e20a5d7cf84c3e</id>
<external_id>1234567</external_id>
<name>Zynk Software</name>
<email>[email protected]</email>
</contact>
</purchase_invoice>
</purchase_invoices>
</sage_one_company>
Invoice Details
The information below is in relation to the main invoice details.
Sage Field | XML Field | Example | Field Type | Input | Notes |
---|---|---|---|---|---|
Invoice Number | invoice_number | SI-45 | string | Optional | Will be auto-generated by Sage if not specified. |
Invoice Date | date | 2017-01-01 | string | Optional | Will be set to today's date if not specified. |
Due Date | due_date | 2017-02-01 | string | Required | |
Supplier Reference | vendor_reference | 46261 | string | Required | |
Reference | reference | 12345 | string | Optional | |
Notes | notes | Leave at reception | string | Optional | |
- | currency_id | GBP | string | Optional | Will default to the supplier's currency if not specified. |
- | exchange_rate | 1.0 | string | Optional |
<?xml version="1.0" encoding="utf-8"?>
<sage_one_company
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<purchase_invoices>
<purchase_invoice>
<invoice_number>PI-45</invoice_number>
<date>2017-01-01</date>
<due_date>2017-02-01/due_date>
<vendor_reference>46261</vendor_reference>
<reference>12345</reference>
<notes>Leave at reception</notes>
<currency_id>GBP</currency_id>
<exchange_rate>1.0</exchange_rate>
</purchase_invoice>
</purchase_invoices>
</sage_one_company>
Item Details
The below information is in relation to the item line details. If a product item code is specified, a product line will be added to the invoice. If a service item code is specified, a service line will be added to the invoice. If no item code is specified, a free text line will be added.
Sage Field | XML Field | Example | Field Type | Input | Notes |
---|---|---|---|---|---|
Product/Service | product/item_code | PENCIL-50 | string | Dependant | Required to add a product line to the invoice |
Product/Service | service/item_code | LABOUR | string | Dependant | Required to add a service line to the invoice |
Description | description | Colouring Pencils - 50pk | string | Required | |
Ledger Account | ledger_account/nominal_code | 5000 | string | Dependant | Either the ledger account name, display name or nominal code must be provided |
Ledger Account | ledger_account/name | Cost of sales - goods | string | Dependant | Either the ledger account name, display name or nominal code must be provided |
Ledger Account | ledger_account/display_name | Cost of sales - goods (5000) | string | Dependant | Either the ledger account name, display name or nominal code must be provided |
Qty/Hrs | quantity | 2 | double | Required | |
Price/Rate | unit_price | 8.33 | double | Required | |
Discount | discount_amount | 8.33 | double | Optional | |
VAT Rate | tax_rate/id | GB_STANDARD | string | Dependant | Either the tax rate ID or name must be provided |
VAT Rate | tax_rate/name | Standard 20.00% | string | Dependant | Either the tax rate ID or name must be provided |
<?xml version="1.0" encoding="utf-8"?>
<sage_one_company
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<sales_invoices>
<sales_invoice>
<invoice_lines>
<!-- Product line -->
<invoice_line>
<product>
<item_code>PENCIL-50</item_code>
</product>
<description>Colouring Pencils - 50pk</description>
<ledger_account>
<nominal_code>5000</nominal_code>
<name>Cost of sales - goods</name>
<display_name>Cost of sales - goods (5000)</display_name>
</ledger_account>
<quantity>1</quantity>
<unit_price>10</unit_price>
<tax_rate>
<id>GB_STANDARD</id>
<name>Standard 20.00%</name>
</tax_rate>
</invoice_line>
<!-- Service line -->
<invoice_line>
<service>
<item_code>LABOUR</item_code>
</service>
<description>Labour</description>
<ledger_account>
<nominal_code>5000</nominal_code>
</ledger_account>
<quantity>6.5</quantity>
<unit_price>10</unit_price>
<tax_rate>
<id>GB_STANDARD</id>
</tax_rate>
</invoice_line>
<!-- Free text line -->
<invoice_line>
<description>Colouring Pencils - 50pk</description>
<ledger_account>
<nominal_code>5000</nominal_code>
</ledger_account>
<quantity>1</quantity>
<unit_price>10</unit_price>
<tax_rate>
<id>GB_STANDARD</id>
</tax_rate>
</invoice_line>
</invoice_lines>
</sales_invoice>
</sales_invoices>
</sage_one_company>