Sage 200 Online Purchase Invoice XML
Purchase Invoices are used to raise invoices against a supplier's account. Uploading a purchase invoice will create a posted transaction, to download purchase invoices see Sage 200 Online Purchase Transaction XML format. Further information can be found on the Sage 200 Online Purchase Invoices API Documentation.
Tasks
Identifiers
external_id
Optional (recommended)
To prevent duplicate purchase invoices being imported into Sage 200 we would recommend to always set the external_id field to a unique id from the source system. When the field is provided it will be stored within Zynk's internal database along with the URN assigned by Sage 200.
Type | Example | XML |
---|---|---|
string(255) | 12345 | <external_id>12345</external_id> |
Fields for Download and Upload
supplier_id
Dependant (see supplier)
Supplier record Id, can also be set using supplier reference, see supplier.
Type | Example | XML |
---|---|---|
integer(int64) | 27006 | <supplier_id>27006</supplier_id> |
transaction_date
Optional
Transaction date.
Type | Example | XML |
---|---|---|
datetime | 2017-06-02T00:00:00 | <transaction_date>2017-06-02T00:00:00</transaction_date> |
due_date
Optional
Date the invoice is due to be paid.
Type | Example | XML |
---|---|---|
datetime | 2017-06-07T00:00:00 | <due_date>2017-07-02T00:00:00</due_date> |
exchange_rate
Optional
Exchange rate for the invoice.
Type | Example | XML |
---|---|---|
number(decimal 6dp) | 1.000000 | <exchange_rate>1.000000</exchange_rate> |
reference
Optional
Invoice reference.
Type | Example | XML |
---|---|---|
string(20) | PO 523452 | <reference>PO 523452</reference> |
second_reference
Optional
Invoice second reference.
Type | Example | XML |
---|---|---|
string(20) | Order #12345 | <second_reference>Order #12345</second_reference> |
settled_immediately
Optional
When set to 'true' this indicates that the invoice has been paid and any settlement discount has been applied.
Type | Example | XML |
---|---|---|
boolean() | false | <settled_immediately>false</settled_immediately> |
vat_adjustment_doc_expected
Optional
Whether a further VAT adjustment document is expected.
Type | Example | XML |
---|---|---|
boolean() | false | <vat_adjustment_doc_expected>false</vat_adjustment_doc_expected> |
document_goods_value
Required
Value of goods.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 120 | <document_goods_value>100</document_goods_value> |
document_tax_value
Required
Tax value.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 120 | <document_tax_value>20</document_tax_value> |
document_discount_value
Required
Value of goods.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 120 | <document_discount_value>0</document_discount_value> |
document_tax_discount_value
Required
Amount VAT is discounted when a settlement discount is applied.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 120 | <document_tax_discount_value>0</document_tax_discount_value> |
discount_percent
Required
Percentage discount.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 0 | <discount_percent>0</discount_percent> |
discount_days
Required
Number of days to pay to qualify for the settlement discount.
Type | Example | XML |
---|---|---|
integer(int16) | 30 | <discount_days>30</discount_days> |
is_authorised
Optional
Determines whether the transaction is to be authorised or not. Note: used only if Purchase Ledger authorisation is on.
Type | Example | XML |
---|---|---|
boolean() | false | <is_authorised>false</is_authorised> |
tax_analysis_items
Optional
Tax analysis lines. The <tax_analysis_items>
node is a collection of <tax_analysis_item>
nodes that allow you analyse the value of the purchase invoice to specific tax codes. See full example XML below.
id
Dependant
Tax code record Id. Can be also looked us via the tax_code
node, see below.
Type | Example | XML |
---|---|---|
integer(int64) | 1 | <id>1</id> |
tax_code
Dependant
Tax code record Id.
Type | Example | XML |
---|---|---|
integer(int16) | 1 | <tax_code><code>1</code></tax_code> |
goods_amount
Optional
Goods amount. Must add up to the headline value set on the invoice.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 100 | <goods_amount>100</goods_amount> |
discount_amount
Optional
Discount amount. Must add up to the headline value set on the invoice.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 0 | <discount_amount>0</discount_amount> |
tax_amount
Optional
Tax amount. Must add up to the headline value set on the invoice.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 20 | <tax_amount>20</tax_amount> |
tax_discount_amount
Optional
Tax discount amount. Must add up to the headline value set on the invoice.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 0 | <tax_discount_amount>0</tax_discount_amount> |
nominal_analysis_items
Optional
Nominal analysis lines. The <nominal_analysis_items>
node is a collection of <nominal_analysis_item>
nodes that allow you analyse the value of the purchase invoice to specific nominal codes. See full example XML below.
code
Required
Nominal account code.
Type | Example | XML |
---|---|---|
string(8) | 4000 | <code>4000</code> |
cost_centre
Optional
Cost centre. If specified must correspond to the code.
Type | Example | XML |
---|---|---|
string(3) | 020 | <cost_centre>020</cost_centre> |
department
Optional
Department. If specified must correspond to the code.
Type | Example | XML |
---|---|---|
string(3) | SAL | <department>SAL</department> |
value
Optional
Value to post to the nominal account.
Type | Example | XML |
---|---|---|
number(decimal 2dp) | 120 | <value>120</value> |
Expandable Fields
Related information linked to purchase invoices are also included in the downloaded XML, these can also be used to set certain fields on purchase invoice uploads using lookups rather than needing to know the internal id of the related record.
supplier
Dependant (see supplier_id)
The purchase invoice supplier. On an upload you can set the reference of the supplier to use for the purchase invoice and Zynk will lookup the correct internal id from Sage.
Upload example using the reference
<supplier>
<reference>ZYNK001</reference>
</supplier>
Example XML
Minimal Example
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<PurchaseInvoice>
<document_goods_value>100</document_goods_value>
<supplier>
<reference>ZYNK001</reference>
</supplier>
</PurchaseInvoice>
</PurchaseInvoices>
Full Example
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<PurchaseInvoice>
<external_id>12345</external_id>
<supplier_id>27006</supplier_id>
<transaction_date>2017-06-02T00:00:00</transaction_date>
<due_date>2017-07-02T00:00:00</due_date>
<exchange_rate>1.000000</exchange_rate>
<reference>PO 523452</reference>
<second_reference>Order #12345</second_reference>
<settled_immediately>false</settled_immediately>
<vat_adjustment_doc_expected>false</vat_adjustment_doc_expected>
<document_goods_value>100</document_goods_value>
<document_tax_value>20</document_tax_value>
<document_discount_value>0</document_discount_value>
<document_tax_discount_value>0</document_tax_discount_value>
<discount_percent>0</discount_percent>
<discount_days>30</discount_days>
<is_authorised>false</is_authorised>
<supplier>
<reference>ZYNK001</reference>
</supplier>
<tax_analysis_items>
<tax_analysis_item>
<id>1</id>
<tax_code>
<code>1</code>
</tax_code>
<goods_amount>100</goods_amount>
<discount_amount>0</discount_amount>
<tax_amount>20</tax_amount>
<tax_discount_amount>0</tax_discount_amount>
</tax_analysis_item>
</tax_analysis_items>
<nominal_analysis_items>
<nominal_analysis_item>
<code>5000</code>
<cost_centre>020</cost_centre>
<department>SAL</department>
<value>120</value>
</nominal_analysis_item>
</nominal_analysis_items>
</PurchaseInvoice>
</PurchaseInvoices>