Next | Order & Stock Management | Integration Guide - API

Next | Order & Stock Management | Integration Guide - API

 

 

 
Next Integration Guide
Data Exchange Over REST API

 

 

 
 

  


Welcome to the Platform 

Kornit X is happy to welcome you to the platform. We work closely with Next to enable integrations for the passing and end to end management of orders for fulfilment by third party suppliers.  This document describes the integration specification for a supplier to integrate to the Kornit X Platform for the Direct Dispatch or Personalised Model.

Kornit X is able to integrate with suppliers using a variety of API options.  

For order management, Kornit X can integrate with supplier systems in order to send Direct Dispatch and Personalised orders. The following order API requirements sections describe the core requirements for order management from a Supplier API.  


Kornit X also has a REST API available for stock management and order status updates.  Details of these are also included in the sections below.



 

Managing Orders via API  

The Order Push API allows a supplier to configure a per dropship URL that will receive order details for any new orders created by Next.  Order details are sent to the URL via a simple JSON POST request. 

Additionally, a X-CustomGateway-Hmac header is also sent as part of the request. This header can be used to verify that the request has originated from Kornit X. 

 

Setup 

To receive order pushes, a supplier must enable the "Generic API" supplier integration against the relevant dropshipping account in the platform, this can be done by your Kornit X contact. 

Once the integration has been enabled, a push URL defined and changes saved, a HMAC key will be automatically generated. 

 

Verifying the HMAC Header

Whilst optional, this step is highly recommended for security. 

For each push request, a HMAC message digest can be calculated using the SHA256 algorithm with the request body as the input and the HMAC key displayed in the Generic API settings page. 

The calculated HMAC message digest should match the value of the requests's X-CustomGateway-Hmac header. 

If the values do not match then you should reject the push request. 


Receiving Orders via API 

Example File Format

Below is an example of the JSON structure you can expect to receive.

{
    "id": 55765718,
    "company_ref_id": 18698,
    "secondary_company_ref_id": "662144", 
    "ref": "ADD1F0CC6564B4FE",
    "status": 1,
    "shipping_company": "",
    "shipping_address_1": "43 TEST STREET",
    "shipping_address_2": "",
    "shipping_address_3": "",
    "shipping_address_4": "TEST",
    "shipping_address_5": "TEST",
    "shipping_postcode": "J34 2JF",
    "shipping_country": "United Kingdom",
    "shipping_country_code": "GB",
    "billing_company": "",
    "billing_address_1": "",
    "billing_address_2": "",
    "billing_address_3": "",
    "billing_address_4": "",
    "billing_address_5": "",
    "billing_postcode": "",
    "billing_country": "United Kingdom",
    "customer_name": "MISS A TESTER",
    "customer_telephone": "",
    "customer_telephone_mobile": "",
    "sale_datetime": "2023-11-27 00:00:00",
    "external_ref": "3572795400",
    "has_been_completed": false,
    "completion_datetime": "0000-00-00 00:00:00",
    "has_pdf_been_queued": false,
    "has_pdf_been_completed": false,
    "shipping_method": "48 Days",
    "customer_email": "ATESTER@YAHOO.CO.UK",
    "shipping_carrier": "OwnCarrier",
    "shipping_tracking": "",
    "shipping_note_url": "",
    "payment_trans_id": "14067",
    "payment_type": "",
    "has_initial_confirmation_email_been_sent": false,
    "has_shipping_confirmation_email_been_sent": false,
    "creation_datetime": "2023-11-27 15:25:50",
    "additional_info": "DQ695212",
    "has_error": false,
    "error_message": "",
    "required_dispatch_date": "2024-01-15",
    "is_status_callback_pending": false,
    "stock_request_id": 0,
    "status_callback_attempts": 0,
    "status_callback_next_retry": "0000-00-00 00:00:00",
    "consolidate": false,
    "has_been_invoiced": false,
    "billing_customer_name": "",
    "billing_customer_email": "",
    "billing_customer_telephone": "",
    "shipping_price": 0,
    "shipping_price_inc_tax": 0,
    "shipping_tax_rate": 0,
    "is_urgent": false,
    "tag": "",
    "pos_user_id": null,
    "coupon_code": "",
    "currency_code": "GBP",
    "is_free_of_charge": false,
    "status_name": "Received",
    "company_external_ref": "",
    "items": [
        {
            "id": 34328128,
            "sale_vat_rate": 0,
            "external_ref": "2799366",
            "ref": "n6xrl213tp",
            "order_id": 55765718,
            "sku": "N04050",
            "mapped_sku": "NXTSSS-DBL",
            "description": "P Snta Stop Strt Sgn",
            "colour": "",
            "size": "DOUBLE",
            "quantity": 1,
            "type": 5,
            "print_job_id": 0,
            "print_job_promise_ref": "",
            "external_url": "",
            "external_thumbnail_url": "",
            "status": 1,
            "print_on_demand_ref": "",
            "plain_stock_item_ref": "",
            "license": "",
            "license_percentage": "",
            "unit_sale_price": 100,
            "unit_sale_price_inc_tax": 100,
            "unit_cost_price": 0,
            "shipping_price": 0,
            "shipping_price_inc_tax": 0,
            "bundle_ref": "",
            "textual_product_id": "12468190",
            "product_variant_id": "3654526",
            "quantity_batched": 0,
            "quantity_dispatched": 0,
            "stock_request_id": null,
            "artwork_barcode": "",
            "quantity_consolidated": 0,
            "product_state_id": null,
            "status_name": "Received",
            "ecommerce": {
                "barcode": "5060441641250"
            },
            "attributes": [],
            "assets": []
        }
    ],
    "pdfs": [
        {
            "id": 36623754,
            "order_id": 55765718,
            "type": 1,
            "ref": "vh2h7w83kz15slg1k5b1",
            "is_outdated": false
        }
    ],
    "shipments": []
}


Example File Format - Annotated

Below is an example of an annotated JSON structure with additional clarity.

{
    "id": KORNITX UNIQUE ORDER ID,
    "company_ref_id": KORNITX ID REFERENCE FOR NEXT,
    "secondary_company_ref_id": "KORNITX SUPPLIER ID", 
    "ref": "KORNITX ORDER REFERENCE",
    "status": 1,
    "shipping_company": "",
    "shipping_address_1": "43 TEST STREET",
    "shipping_address_2": "",
    "shipping_address_3": "",
    "shipping_address_4": "TEST",
    "shipping_address_5": "TEST",
    "shipping_postcode": "J34 2JF",
    "shipping_country": "United Kingdom",
    "shipping_country_code": "GB",
    "billing_company": "",
    "billing_address_1": "",
    "billing_address_2": "",
    "billing_address_3": "",
    "billing_address_4": "",
    "billing_address_5": "",
    "billing_postcode": "",
    "billing_country": "United Kingdom",
    "customer_name": "MISS A TESTER",
    "customer_telephone": "",
    "customer_telephone_mobile": "",
    "sale_datetime": "TIMESTAMP ON THE ORDER FROM NEXT",
    "external_ref": "KORNIT X ORDER REFERENCE",
    "has_been_completed": false,
    "completion_datetime": "0000-00-00 00:00:00",
    "has_pdf_been_queued": false,
    "has_pdf_been_completed": false,
    "shipping_method": "NEXT EXPECTED LEAD TIME",
    "customer_email": "ATESTER@YAHOO.CO.UK",
    "shipping_carrier": "OwnCarrier",
    "shipping_tracking": "",
    "shipping_note_url": "",
    "payment_trans_id": "NEXT INVOICE NUMBER",
    "payment_type": "",
    "has_initial_confirmation_email_been_sent": false,
    "has_shipping_confirmation_email_been_sent": false,
    "creation_datetime": "2023-11-27 15:25:50",
    "additional_info": "DQ695212",
    "has_error": false,
    "error_message": "",
    "required_dispatch_date": "NEXT DELIVERY PROMISE DATE",
    "is_status_callback_pending": false,
    "stock_request_id": 0,
    "status_callback_attempts": 0,
    "status_callback_next_retry": "0000-00-00 00:00:00",
    "consolidate": false,
    "has_been_invoiced": false,
    "billing_customer_name": "",
    "billing_customer_email": "",
    "billing_customer_telephone": "",
    "shipping_price": 0,
    "shipping_price_inc_tax": 0,
    "shipping_tax_rate": 0,
    "is_urgent": false,
    "tag": "",
    "pos_user_id": null,
    "coupon_code": "",
    "currency_code": "GBP",
    "is_free_of_charge": false,
    "status_name": "Received",
    "company_external_ref": "",
    "items": [
        {
            "id": 34328128,
            "sale_vat_rate": 0,
            "external_ref": "2799366",
            "ref": "n6xrl213tp",
            "order_id": 55765718,
            "sku": "NEXT ITEM NUMBER",
            "mapped_sku": "MANUFACTURER SKU",
            "description": "ITEM DESCRIPTION SHORT",
            "colour": "",
            "size": "SIZE",
            "quantity": 1,
            "type": 5,
            "print_job_id": 0,
            "print_job_promise_ref": "",
            "external_url": "",
            "external_thumbnail_url": "",
            "status": 1,
            "print_on_demand_ref": "",
            "plain_stock_item_ref": "",
            "license": "",
            "license_percentage": "",
            "unit_sale_price": 100,
            "unit_sale_price_inc_tax": 100,
            "unit_cost_price": 0,
            "shipping_price": 0,
            "shipping_price_inc_tax": 0,
            "bundle_ref": "",
            "textual_product_id": "12468190",
            "product_variant_id": "3654526",
            "quantity_batched": 0,
            "quantity_dispatched": 0,
            "stock_request_id": null,
            "artwork_barcode": "",
            "quantity_consolidated": 0,
            "product_state_id": null,
            "status_name": "Received",
            "ecommerce": {
                "barcode": "5060441641250"
            },
            "attributes": [],
            "assets": []
        }
    ],
    "pdfs": [
        {
            "id": 36623754,
            "order_id": 55765718,
            "type": 1,
            "url": "URL FOR DISPATCH NOTE TO DOWNLOAD, PRINT AND INCLUDE WITH ORDER",
            "ref": "vh2h7w83kz15slg1k5b1",
            "is_outdated": false
        }
    ],
    "shipments": []
}

 


Personalisation

Personalisation may not always be included as textual data within the JSON payload - this is dependent on product set up.
Your Kornit X representative can provide more information on this to allow you to determine if API is a suitable integration solution based on your product offering.


Order Consolidation 

As standard, orders will be passed as individual order lines and the supplier can consolidate at the packing stage if desired.   
For example, if a customer orders 2 products from Next in 1 transaction, two individual orders with unique order references will be passed to the supplier. 

 

 

 

 However, there are systemic solutions available - these should be discussed and agreed with the Next team directly. 

Branded Dispatch Notes

A branded A4 Dispatch Note must be included within each order. It contains information which is vital for the Customer Returns process.    

An example Dispatch Note can be viewed here

The Dispatch Note is available to download and print from the platform. 

If you are integrating directly with the platform, a URL will be included with the data where you will be able to access and print the Dispatch Note. 


Dispatch / Delivery Date 

Please note that the "required_dispatch_date" is the date that the customer is expecting the product to be delivered to them, therefore you should be dispatching before this date with enough time to include your delivery. 


Acknowledging Orders via API

When an order is successfully received by the endpoint, a 200 OK response will be returned to Kornit X - this serves as the order acknowledgement.


Shipping Orders via API

Order Shipment Endpoint

The Order Shipment Endpoint is only required in instances where the fulfiller needs to return a shipment label. Please note by using this end point you will not update the status of your order, only return a shipment label.  

 

Don't forget to replace :id with the order's unique numeric ID. 

The shipping service used is automatically determined based on how your account has been configured. 

A successful request will result in one or more shipment entities being created and returned. 

If an order has been split into multiple shipments, then the items collection on each shipment can be used to identify which items are included in that particular shipment. 

A successful request will result in an array of shipments being returned: 

 

 


Order Status API


Once the order has been completed and dispatched to the customer, the brand should update the status of the order.   Where possible, tracking information should be included as part of the status update.

To update the Status to Dispatched and provide Tracking Information, the following call should be executed:
      curl -X PUT -d '{ "status": 8, "shipping_tracking": "ABC"}' -H "authorization: basic REFID:APIKEY -H "content-type: application/json" "https://api-sl-2-2.custom-gateway.net/order/:id/status"


If tracking information isn't available, the following call should be executed:

      curl -X PUT -d '{ "status": 8 }' -H "authorization: basic REFID:APIKEY" -H "content-type: application/json" "https://api-sl-2-2.custom-gateway.net/order/:id/status" 

  


Where:
  • REFID = Fulfiller Company Code (this will be provided by Kornit X)

  • KEY = API Key associated to the Fulfiller Company (this will be provided by Kornit X) 

  • ID = Internal Order ID (this will be passed with the order data)




Cancelling Orders via API

If a supplier is unable to fulfill an order, the order can be cancelled via the API.  To do so, the following call should be executed: 

  

      curl -X PUT -d '{ "status": 128 }' -H "authorization: basic REFID:APIKEY" -H "content-type: application/json" "https://api-sl-2-2.custom-gateway.net/order/:ID/status" 

  

Where:

  • REFID = Fulfiller Company Code (this will be provided by Kornit X)

  • KEY = API Key associated to the Fulfiller Company (this will be provided by Kornit X) 

  • ID = Internal Order ID (this will be passed with the order data)

 

 




Managing Inventory via API

Kornit X provides a Stock API to allow suppliers to provide up-to-date stock information when stock positions change. This is updated via a Kornit X API end-point which uses basic authentication via a company ref ID and API key which you can obtain from your Kornit X contact by request. 

The stock API allows Next Suppliers to POST stock updates using a RESTful API.  


Stock values can be provided based on either a ring-fenced or shared stock pool. Where the stock is ring-fenced, the frequency with which the data is provided is less critical.  However, if stock is part of a shared stock pool, stock updates are required frequently, based on stock position changes, in order to mitigate issues with fulfillment.

The main stock file (full feed) is to be received by Kornit X daily, at a designated time. There is an option to submit further delta files containing absolute values received at designated intervals, following the processing of the Next order files.

A stock quantity of 0 should be sent if the Brand would like to remove an item from the Next website. A stock update of zero will update the item to show “Currently unavailable” on the Next website, then after 20 minutes the item will be automatically removed from the search feed, unavailable for customers to purchase.


Example Data Format

For stock updates, there is a simple call that allows the update of stock quantity, based on the manufacturer’s sku assigned to the stock product. 
The following provides an example of a call that sets the quantity of two stock products. 

 

      curl -X PUT -d'[ { "sku": "ABCD", "data":  { "quantity_available": 10 } }, { "sku": "EFGH", "data": { "quantity_available": 12 } } ]' -H "Authorization: Basic REFID:<KEY>" -H"Content-type: application/json" https://api-sl-2-2.custom-gateway.net/stock/availability 

 

Where:

  • REFID = Fulfiller Company Code (this will be provided by Kornit X)

  • KEY = API Key associated to the Fulfiller Company (this will be provided by Kornit X) 


 

The following illustrates a sample of the data structure and attributes retrieved by the above API call: 

 {

"successful": [ { "id": 8965089, "quantity_available": 1001, "last_modified": "2023-10-18 08:30:01" }, { "id": 8274177, "quantity_available": 500, "last_modified": "2023-10-18 08:30:01" } ] }



  

 


    • Related Articles

    • Next | Order & Stock Management | Integration Guide - CSV

      Next Integration Guide CSV File Data Exchange Over SFTP Welcome to the Kornit X Platform Kornit X is happy to welcome you to the platform. We work closely with Next to enable integrations for the passing and end to end management of orders for ...
    • Next | Order & Stock Management | Integration Guide - XML

      Next Integration Guide XML File Data Exchange Over SFTP Welcome to the Kornit X Platform Kornit X is happy to welcome you to the platform. We work closely with Next to enable integrations for the passing and end to end management of orders for ...
    • Next | Order & Stock Management | KornitX Platform For Label Plus

      Label Plus+ Suppliers Using the Kornit X Platform Please note we are now known exclusively as Kornit X, a division of Kornit Digital – Custom Gateway was our name before our takeover. To access the platform please refer to the following link – CLICK ...
    • Next | Order & Stock Management | KornitX Platform For Direct Dispatch

      Direct Dispatch Suppliers Using the Kornit X Platform Please note we are now known exclusively as Kornit X, a division of Kornit Digital – Custom Gateway was our name before our takeover. To access the platform please refer to the following link – ...
    • Next | Order & Stock Management | KornitX Platform For Personalised

      Personalised Suppliers Using The Kornit X Platform Please note we are now known exclusively as Kornit X, a division of Kornit Digital – Custom Gateway was our name before our takeover. To access the platform please refer to the following link – CLICK ...