If you want to create Sales Orders in Vinsight, here is an example of the data you will want to POST to our API.
It is more data that strictly necessary to create an Order but also includes data to make a better user experience eg see the order url from the system the order originated in.
Here is a fairly minimum POST:
POST https://app.vinsight.net/SalesOrders
{ "ContactNum": 41, "InvoiceDate": "2022-08-25T00:00:00+14:00", "OrderReference": "Your preferred Square Invoice Ref", "Categories": "source:Square;channel:POS;", "DateRequired": "", "DeliveryName": "Bobby Brown", "DeliveryAddress": "", "DeliverySuburb": "", "DeliveryCity": "", "DeliveryRegion": "NSW", "DeliveryPostCode": "", "DeliveryCountry": "Australia", "DeliveryEmail": "", "DeliveryPhone": "", "DeliveryInstructions": "", "CurrencyNum": 1, "PaymentTermDescription": "", "DatePaymentDue": "", "DatePaid": "", "Comments": "", "CurrencyRate": 1, "DivisionNum": 1, "Items": [{ "Description": null, "Quantity": 1, "UnitOfMeasureCode": "12x750ml", "UnitPrice": 192, "Discount": 0, "SalesTaxRateValue": 0.10, "SalesTaxRateNum": 1, "PriceDescription": null, "CurrencyNum": 1, "StockItemNum": 1, "Sort": 0 } ], "Aliases": [{ //Vinsight Type "EntityType": "SalesOrder", "Domain": "Square", //Square Merchant Id "SubDomain": "2RNAQEEXAMPLE", //Square Type "DomainEntityType": "Order", //Square Order Id "DomainEntityId": "807269269574", //Square Order Display Num or orderreference if any "DomainEntityCode": "#1003", //url to Square order "DomainEntityUrl": "https://my-store.myshopify.com/admin/orders/123456789", //Sqaure datemodified or similar "DomainData": "{\"UpdatedAt\":\"2022-01-13T22:20:06-05:00\"}" } ] } |
NB: Remember to remove the comment lines from the above example as json does not allow comments.
You will need to pre-lookup and cache on your server (or create the references for) the following data:
You can test both POST and GETs in our API page: https://app.vinsight.net/ApiRequests?view-mode=create
eg:
JSON Example – Creating a Sales Order via API using Unmatched Items workflow
If you don’t want to look up existing id values for Contacts or Stock Items, it is also possible to create a Sales Order using the Unmatched Items workflow.
This is useful if you don’t know the exact codes to search for, or they are slightly different between the two systems.
{ "ContactNum": 0, // We are using the "Not Matched" placeholder ID here "InvoiceDate": "2022-08-25T00:00:00+14:00", "OrderReference": "Your preferred Square Invoice Ref", "Categories": "source:Square;channel:POS;", "DateRequired": "", "DeliveryName": "Bobby Brown", "DeliveryAddress": "", "DeliverySuburb": "", "DeliveryCity": "", "DeliveryRegion": "NSW", "DeliveryPostCode": "", "DeliveryCountry": "Australia", "DeliveryEmail": "", "DeliveryPhone": "", "DeliveryInstructions": "", "CurrencyNum": 1, "PaymentTermDescription": "", "DatePaymentDue": "", "DatePaid": "", "Comments": "", "CurrencyRate": 1, "DivisionNum": 1, "Items": [{ "Description": null, "Quantity": 1, "UnitOfMeasureCode": "12x750ml", "UnitPrice": 192, "Discount": 0, "SalesTaxRateValue": 0.10, "SalesTaxRateNum": 1, "PriceDescription": null, "CurrencyNum": 1, "Sort": 0, // We are using the "Not Matched" placeholder ID here "StockItemNum": 0, "Aliases": [{ // This Alias is telling us about the StockItemNum property. // The Stock Item is intended to represent the product in Square "EntityUniqifier": "StockItemNum", "Domain": "Square", "SubDomain": "2RNAQEEXAMPLE", "DomainEntityType": "Product", "DomainEntityId": "1624799388", "DomainEntityCode": "MY SAUVIGNON BLANC 750ML", // Some form of minimal DomainData is required for Product Matching "DomainData": "{\"ProductSKU\":\"#12345\"}" }] } ], "Aliases": [ { // This Alias is telling us where the document came from, not required for the Matching process "EntityType": "SalesOrder", "Domain": "Square", "SubDomain": "2RNAQEEXAMPLE", "DomainEntityType": "Order", "DomainEntityId": "807269269574", "DomainEntityCode": "#1003", "DomainEntityUrl": "https://my-store.myshopify.com/admin/orders/123456789", "DomainData": "{\"UpdatedAt\":\"2022-01-13T22:20:06-05:00\"}" }, { // This Alias is telling us about the ContactNum property. // The Contact is intended to represent the customer in Square "EntityUniqifier": "ContactNum", "Domain": "Sqaure", "SubDomain": "2RNAQEEXAMPLE", "DomainEntityType": "Customer", "DomainEntityId": "9811884231", "DomainEntityDescription": "Bobby Brown" } ] }