Order APIs

1. Background

SUNMI Store system is a store management system provided by SUNMI for merchants based on the IoT devices in stores.

As an open platform, SUNMI Store can do data interchange for third-party SaaS providers, including the interchange of product information, transaction information and membership system.

Multiple SUNMI IOT device can help the user to digitize their shop. Based on the data from their shop such as face recognition and customer statistics along with the order info from saas provider, user could analyze their shops better.

This document describes how to exchange data with the third party saas provider to make sure SUNMI store open platform can get the order information from saas provider as soon as possible to do analysis.

2. API Specification

2.1 Protocol

All APIs use HTTPS Protocol with POST method

Note: The size of the request body should be no more than 1 MB. If this size is exceeded, open platform will deny it.

Content-Typeapplication/x-www-form-urlencoded
return typeJSON
encodingUTF-8
signing algorithmMD5
signing rulessee chapter 2.2

2.2 Signing rules

see Authentication

2.3 Common parameter

parameterrequiredtypedescription
app_idyesstringunique identifier provided by SUNMI store open platform
randomyesstring6-10 digit random string with number and alphabets
timestampyesint10 digit current unix timestamp
signyesstringsee chapter 2.2

3 APIs

3.1 Order APIs

3.1.1 Parameters

The following parameters are all for SUNMI store open platform and is used to explain APIs. Saas providers must provide the parameter of their own to make sure the order can be synced to open platform.

The parameters in the order below are the basics properties of an order, there will be more properties in real orders.

Order
parametertyperequireduniquedescription
order_nostringthe unique identifier of an order
order_typeinttype of an order(1- normal order、 2- canceled, 3-exchanged for new product, 4- suspend,5-报表)
order_timeintorder timestamp
order_start_timeintthe start time of an order
purchase_amountdouble (2 digit precision)
discount_amountdouble (2 digit precision)
received_amountdouble (2 digit precision)
payment_typeint1-cash、2-alipay、3-wechat pay、4-QQpay、5-JD wallet、6-credit card、7-unionpay QR code、8-other
customer_countintdefault 1
device_snstring
software_namestring
software_specstring
hardware_namestring
hardware_specstring
cashier_nostring
cashier_diskstring
shop_assistant_nostring
order_sourceint1-offline、 2-online (default offline)
member_nostring
ali_idstring
wechat_open_idstring
member_pointsdouble
coupon_nostring
coupon_source int1-shop,2-alipay, 3-wechat pay, 4-other
receipt_nostring
sunmi_receipt_nostring
product_listarray[product]
see the list below
product
parametertypedescriptionrequired
namestringname of the product
seq_numstringsequence number of the product
bar_codestringbar code of the product
specstringspec of the product
unitstringunit of the product
quantitydouble (3 digit precision)sell quantity
stock_quantity double (3 digit precision) stock quantity
original_pricedouble (2 digit precision) original price
present_pricedouble (2 digit precision) current price
promote_amountdouble (2 digit precision) promotion price
subtotal_amountdouble (2 digit precision) subtotal of this product
product additional properties for specific product
parametertypedescriptionrequired
colorstringcode for color
sizestringcode for size

3.1.2 Update order 

API description: By requesting this API, the saas provider can notify the SUNMI store open platform that there is a new order in their system.

API address:/order/update(this is for reference, the detail of this API for each saas provider will be different and needed to be discussed)

Parameters

parameterrequiredtypedescription
shop_idyesstringThe identifier of the shop in open platform
order_listyesarraythe list of order needed to be update

Return value: 

{
  code: 0,
  msg: "succeed",
  data: {
    "invalid_list": [
      "CN0000938",
      "CN0000939"
    ]
  }
}

Errors:

Error codeDescription
5041invalid saas provider
5047invalid order

4 Return value

4.1 Error type

Error types will be returned in HTTP response. If the sign is invalid, then the http status code 401 will be returned.

If the sign is valid, then it will return HTTP status code 200 whatsoever, the error will be returned in the HTTP response body. The structure of our response body is normally:

{
    code:0
    msg: "success"
    data: {}
} 

4.2 Error list

see Error List

5 Examples