Skip to content

Sage 200 Online Sales Allocation XML

Sales Allocations are used to allocate the sales transactions against a customer's account. Further information can be found on the Sage 200 Online Sales Allocation API Documentation.

Tasks

Identifiers

external_id

Optional (recommended)
To prevent duplicate sales allocations 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

customer_id

Dependant (see customer)
Customer record Id, can also be set using customer reference, see customer.

Type Example XML
integer(int64) 27006 <customer_id>27006</customer_id>

allocation_lines

Required
Allocation lines. The <allocation_lines> node is a collection of <allocation_line> nodes that allow you to specify which transactions to allocate, and the monetary amount to be allocated to/from each one. See full example XML below.

posted_tran_id

Dependant (see posted_tran)
The Id of the invoice, receipt, payment or credit note to allocate. The Id can also be looked up based on the URN, reference and second reference using customer reference, see posted_tran.

Type Example XML
integer(int64) 4000 <posted_tran_id>12345</posted_tran_id>

value_to_allocate

Required
The value to allocate to/from this transaction. A positive value will allocate money to a transaction (e.g. a sales invoice), and a negative value will allocate money from a transaction (e.g. a sales receipt). The total across all allocation lines must come to 0. In other words, you must specify both the transaction the money is coming from, and going to.

Type Example XML
number(decimal 2dp) 12.00 <value_to_allocate>12.00</value_to_allocate>

allocation_date

Optional
Allocation date.

Type Example XML
datetime 2017-06-02T00:00:00 <allocation_date>2017-06-02T00:00:00</allocation_date>

Expandable Fields

Related information linked to sales allocations can be used to set certain fields on sales allocation uploads using lookups rather than needing to know the internal id of the related record.

customer

Dependant (see customer_id)
The sales invoice customer. On an upload you can set the reference of the customer to use for the sales invoice and Zynk will lookup the correct internal id from Sage.

Upload example using the reference

<customer>
    <reference>ZYNK001</reference>
</customer>

posted_tran

Dependant (see posted_tran_id)
The transaction to allocate. On an upload you can either provide the urn, or provide a trader_transaction_type, reference and second_reference of the transaction, and Zynk will lookup the correct internal id from Sage.

Upload example using the urn

<posted_tran>
    <urn>1329</urn>
</posted_tran>

Upload example using the trader_transaction_type, reference and second_reference

<posted_tran>
    <trader_transaction_type>TradingAccountEntryTypePurchasePaymentSalesReceipt</trader_transaction_type>
    <reference>0000009123</reference>
    <second_reference>0000009123</second_reference>
</posted_tran>

Example XML

Minimal Example

<?xml version="1.0" encoding="utf-8"?>
<SalesAllocations>
  <SalesAllocation>
        <customer_id>12345</customer_id>
        <allocation_lines>
            <allocation_line>
                <posted_tran_id>241513</posted_tran_id>
                <value_to_allocate>12</value_to_allocate>
            </allocation_line>
            <allocation_line>
                <posted_tran_id>242434</posted_tran_id>
                <value_to_allocate>-12</value_to_allocate>
            </allocation_line>
        </allocation_lines>
    </SalesAllocation>
</SalesAllocations>

Full Example

<?xml version="1.0" encoding="utf-8"?>
<SalesAllocations>
  <SalesAllocation>
    <customer_id>12345</customer_id>
    <customer>
      <reference>ZYNK0001</reference>
    </customer>
    <allocation_lines>
      <allocation_line>
        <posted_tran_id>241513</posted_tran_id>
        <posted_tran>
          <urn>1329</urn>
        </posted_tran>
        <value_to_allocate>12</value_to_allocate>
      </allocation_line>
      <allocation_line>
        <posted_tran_id>242434</posted_tran_id>
        <posted_tran>
          <trader_transaction_type>TradingAccountEntryTypePurchasePaymentSalesReceipt</trader_transaction_type>
          <reference>0000009123</reference>
          <second_reference>0000009123</second_reference>
        </posted_tran>
        <value_to_allocate>-12</value_to_allocate>
      </allocation_line>
    </allocation_lines>
    <allocation_date>2021-03-02</allocation_date>
  </SalesAllocation>
</SalesAllocations>