This is a new version of the Sales Order which was release 1/11/2025 and replaces v6
Purpose
Allows new orders to be posted though an API into Vision Commerce. It can be used for external systems or web sites
Request
Action : POST
URL : http://<path_to_api>/SalesOrder?Version=v7
This API needs to be authenticated ( pass header parameter Authorization : "Bearer "+AccessToken )
Licensing
To use this module you will require a license. There is a small monthly charge to have this switched on.
Warnings
Order Total & Tax Total sent through to the API will override any Commerce calculation. When posting the invoice to the finance system, the values posted to the API will always be used.
Specification
Tag | Element | Recurring Element | Data type | (M)andatory | Notes or limitations | Vision Commerce field |
|---|---|---|---|---|---|---|
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||||
<Order> | ||||||
<OType> | varchar(2) | M | Options SO - Standard Order (defaut) EP - EP Order | FKSalesOrderType | ||
<Warehouse> | varchar(6) | M | The Commerce warehouse code of the warehouse to be used for the order otherwise it will default to the warehouse set in the API admin options | WareHouseCode | ||
<UnderBondType> | varchar(2) | M | Normal Use for GB Duty Paid orders is “DP” You can set the default order type in the API Interface Menu. The system whilst designed predominantly for duty paid ecommerce orders can also accept other order types as well, these all use the standard codes, however all these orders will arrive and be placed on hold whilst the user checks the order as additional information is usually required.
| Under Bond Type | ||
<Customer> | varchar(8) | MC | Either field must be provided. | Customer | ||
<CustID> | bigint | MC | ||||
<OrderDate> | date | M | format YYYY-MM-dd | Order Date | ||
<ReleaseDate> | datetime | MC | YYYY-MM-dd HH:mm:ss format Web site completed date/time (time of transmission) | Release Date | ||
<WebOrderID> | bigint | M | This should be the website's unique reference for the order | Stored in OtherInfo=> Notes field | ||
<CustomerRef> | varchar(30) | O | The customer’s reference for the order | Customer Ref | ||
<DName> | nvarchar(50) | M | Delivery Name | Delivery Name | ||
<DAdd1> | nvarchar(50) | M | Delivery Address | Delivery Address1 | ||
<DAdd2> | nvarchar(50) | O | Delivery Address2 | |||
<DAdd3> | nvarchar(50) | O | Delivery Address3 | |||
<DTown> | nvarchar(50) | M | Delivery Town | Delivery Town | ||
<DPC> | varchar(15) | M | Delivery Postcode | Postcode | ||
<DCtry> | varchar(2) | M | Delivery Country - ISO 2 digit country code | Country code | ||
<DSM> | varchar(30) | O | Checks if valid and setup [may not be the same as the carrier codes] | Sets Carrier based on ShippingMethodID | ||
<DSMOC> | varchar(30) | O | Delivery Shipping Method Override Code Only specify if required and different to standard delivery service | If DSM is set (i.e. carrier delivery, not a warehouse delivery) then this will simply be used to set ‘Service Codes’, otherwise this will be used to lookup & set the ‘Delivery Service’ | ||
<DCont> | nvarchar(30) | O | Delivery Contact | Delivery Contact | ||
<DContNo> | varchar(50) | O | Delivery Contact Telephone No | Delivery Contact No (Telephone) | ||
<DContEm> | varchar(50) | O | Delivery Contact Email | Delivery Contact Email | ||
<DInstr> | varchar(120) | O | Delivery Instructions Will use customers default instructions unless this has something different when this will over write. | Delivery Instructions | ||
<D1From> | char(5) | C | If you provide a <D1From> time you MUST provide a <D1To> time If none of the delivery window fields are specified then the API will default the delivery window from the customer record (if set there). Format HH:mm | Delivery Window From | ||
<D1To> | char(5) | C | Delivery Window To | |||
<D2From> | char(5) | C | This is a second set of time fields which are not required, however you can only use these fields if you have already submitted <D1From> and <D1To> If you provide a <D2From> time you MUST provide a <D2To> time If none of the delivery window fields are specified then the API will default the delivery window from the customer record (if set there). Format HH:mm | Later Delivery Window From | ||
<D2To> | char(5) | C | Later Delivery Window To | |||
<AccountManager> | varchar(8) | O | Sales Order Analysis 1 Used to override the default option for the primary customer analysis code on a sales order | Account Manager | ||
<Type> | varchar(8) | O | Sales Order Analysis2 Used to override the default option for the secondary customer analysis code on a sales order | Type | ||
<SMsgDocNo> | int | O | Special message document | SM Document ID | ||
<SMsgDocument> | varchar(80) | O | Special message document type | SM Document Type | ||
<SMsgQuantity> | int | O | Special message quantity | SM Quantity | ||
<SMsgHeader> | varchar(120) | O | Special message Header | Special Message Text 3 | ||
<SMsgTo> | varchar(80) | O | Special message recipient (to) | Special Message Text 5 | ||
<SMsg1> | varchar(4096) | O | Saved in the order "warehouse options" – please check availability with the warehouse. Used by customers who wish to put a card inside the delivery for the receiver. Can be used for “Happy Birthday” “Merry Christmas” messages or similar. Can be HTML formatted or plain text. | SpecialMessageText1 | ||
<SMsg2> | varchar(4096) | O | This is line 2 of the message text and is predominantly used as a marketing message for the receiver of the goods. Can be HTML formatted or plain text. | SpecialMessageText2 | ||
<SMsgFrom> | varchar(80) | O | Special message sender (from) | Special Message Text 6 | ||
<SMsgFooter> | varchar(120) | O | Special message footer | Special Message Text 4 | ||
<SMsgEmail> | O | Special Message Email address | Not currently in use | |||
<CartDiscount> | decimal(9,4) | O | Total Discount Amount | |||
<LineTotal> | decimal(9,4) | O | Not including VAT | Line total | ||
<LineTaxTotal> | decimal(9,4) | O | This should be <OrderLinesTotal> less <OrderCartDiscount> and the vat of the net amount | Line tax Totals | ||
<Fee> | decimal(9,4) | O | Surcharge for Credit Card Payment | Surcharges > Price / Unit (SurchargePrice), | ||
<FeeTax> | decimal(9,4) | O | Surcharge tax | tblVisionSalesOrderHeaderAPI.FeeTaxTotal | ||
<Shipping> | decimal(9,4) | O | Not including VAT | Sundry Shipping Amount | ||
<ShippingTax> | decimal(9,4) | O | VAT on Shipping Total | |||
<TaxTotal> | decimal(9,4) | O | If declared this is the VAT element of the sale If not declared we will assume VAT at prevailing rate against OrderTotal | tblVisionSalesOrderHeaderAPI.TaxTotal | ||
<OrderTotal> | This should be Order Lines Total - Order Discount + Shipping Total + Fee Total | aderAPI.OrderTotal | ||||
<OrderLines> | ||||||
<Item> | M | Section can be repeated with the <Item>, repeat for each individual order line | tblVisionSalesOrderDetail | |||
<ProductCode> | varchar(30) | M | Product Code | |||
<RotationNo> | varchar(15) | O | RotationNumber | |||
<Units> | int | M | No of Cases | |||
<Singles> | int | C | Number of Singles | |||
<UnitPrice> | decimal(9,2) | C | After discounts and excluding VAT | PricePerUnit | ||
<SinglePrice> | decimal(9,2) | C | After discounts and excluding VAT | PricePerSingle | ||
<LineTotal> | decimal(9,4) | O | After discounts and excluding VAT | Total Price for the line, EX VAT | ||
<LineTax> | decimal(9,4) | O | VAT for this line | VAT total for the line | ||
</Item> | ||||||
</OrderLines> | ||||||
<Payments> | ||||||
<Payment> | O | Segment can be repeated - allows multiple payments to be posted per order, if empty then payment on account is assumed | API Payment Details | |||
<PaymentMethodID> | varchar(30) | C | Checks if valid and sets code Mandatory if <Payments> segment submitted | FKPaymentMethod | ||
<PaymentMethod> | varchar(30) | O | Description of Payment Method | Not currently in use | ||
<Value> | decimal(9,2) | C | Mandatory if <Payments> segment submitted, total paid with this payment method | Value | ||
<TID> | varchar(50) | C | Payment Transaction ID returned from vision live payment gateway | BillingTID | ||
<Name> | nvarchar(30) | C | Conditional depending on payment method ID | BillingName | ||
<Company> | varchar(50) | C | BillingCompany | |||
<Address1> | nvarchar(50) | C | BillingAddress1 | |||
<Address2> | nvarchar(50) | C | BillingAddress2 | |||
<City> | nvarchar(50) | C | BillingCity | |||
<State> | nvarchar(50) | C | BillingState | |||
<Postcode> | varchar(15) | C | BillingPostcode | |||
<Country> | varchar(2) | C | Billingcountry | |||
<Email> | varchar(50) | C | BillingEmail | |||
<Phone> | varchar(20) | C | BillingPhone | |||
<FirstName> | nvarchar(30) | C | Not currently in use | |||
<LastName> | varchar(30) | C | ||||
</Payment> | ||||||
</Payments> | ||||||
</Order> | ||||||
Sample
Body XML sample
<?xml version="1.0" encoding="UTF-8"?> <Order> <OType>SO</OType> <Warehouse>MAIN</Warehouse> <UnderBondType>U</UnderBondType> <Customer>R2</Customer> <OrderDate>2025-09-19</OrderDate> <ReleaseDate>2025-09-19</ReleaseDate> <WebOrderID>10002608</WebOrderID> <CustomerRef>REF2608</CustomerRef> <DName>Royal Wines & Spirits</DName> <DAdd1>Royal House (Demo)</DAdd1> <DAdd2>28 Sovereign St</DAdd2> <DAdd3>Leeds</DAdd3> <DTown>West Yorkshire</DTown> <DPC>LS1 4BJ</DPC> <DCtry>GB</DCtry> <DSM>CARR1</DSM> <DSMOC>SAT</DSMOC> <DCont>Mrs Jones</DCont> <DContNo>0113 396 9002</DContNo> <DContEm>mrsjones@royalwinesandspirits.uk</DContEm> <DInstr>Use the rear door for the delivery</DInstr> <D1From>09:00</D1From> <D1To>12:30</D1To> <D2From>14:00</D2From> <D2To>17:00</D2To> <AccountManager>GEN</AccountManager> <Type>RTL</Type> <SMsgDocNo>20</SMsgDocNo> <SMsgDocument>Happy Birthday</SMsgDocument> <SMsgQuantity>2</SMsgQuantity> <SMsgHeader>Happy Birthday</SMsgHeader> <SMsgTo>John Smith</SMsgTo> <SMsg1>Happy Birthday</SMsg1> <SMsg2>Hope you have a great day</SMsg2> <SMsgFrom>Sue Jones</SMsgFrom> <SMsgFooter>Happy Birthday</SMsgFooter> <SMsgEmail /> <CartDiscount>0</CartDiscount> <LineTotal>156.50</LineTotal> <LineTaxTotal>2</LineTaxTotal> <Fee>0</Fee> <FeeTax>0</FeeTax> <Shipping>5.00</Shipping> <ShippingTax>2</ShippingTax> <TaxTotal>2</TaxTotal> <OrderTotal>166.50</OrderTotal> <OrderLines> <Item> <ProductCode>IT9020I19</ProductCode> <RotationNo /> <Units>2</Units> <Singles>0</Singles> <UnitPrice>156.50</UnitPrice> <SinglePrice>13.04</SinglePrice> <LineTotal>156.50</LineTotal> <LineTax>0</LineTax> </Item> </OrderLines> <Payments> <Payment> <PaymentMethodID>300</PaymentMethodID> <PaymentMethod>Credit Card</PaymentMethod> <Value>166.50</Value> <Name /> <Company>Ontech</Company> <Address1>Brentwood</Address1> <Address2>East England</Address2> <City>Brentwood</City> <State>Essex</State> <Postcode>CM131BN</Postcode> <Country>England</Country> <Phone>9946938619</Phone> <Email>testers@ontech.uk</Email> <TID>BL002</TID> </Payment> </Payments> </Order>
Response / error codes
HTTP Status code | Description |
|---|---|
200 | Order saved |
201 | Order saved, however auto submission failed |
400 | Something wrong with input or processing, |
Response Examples
Response (status code 200)
Order saved
Response (status code 400)
Node WebOrderID is not supplied