addStore

POST /v2/pds/store/addStore

With this API call, the SaaS provider or ISV can add a store to the current stores that have been synchronized via the initializeStore API.

Note: To add a store, make sure one of the following conditions are met:

Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:

Request parameters

Field

Data type

Required

Description

Example

appId

String

No

Indicates the unique ID assigned by Mini Program Platform to identify a mini program.

  • Maximum length: 32 characters
  • Characters not allowed: special characters such as @ # ?

Note: Obtain this field via the my.getAppIdSync JSAPI or Mini Program Platform.

"2102010113769***"

requestId

String

Yes

Indicates the unique ID assigned by the SaaS provider or ISV to identify a request for adding a store.

  • Maximum length: 255 characters

Note: This field is an idempotency field. For the addStore requests using the same requestId value, our server must return the same result. For details about API idempotency, see the Idempotency chapter.

"store_2022012111061234567890"

store

Store

Yes

Indicates the details of the store to add.

-

Response parameters

Field

Data type

Required

Description

result

Result

Yes

Indicates the request result, such as status and error codes.

Result process logic

In the response, the result.resultStatus field indicates the result of processing a request. The following table describes each result status:

Result status

Description 

A

The request for adding the store is accepted by us.

The corresponding result.resultCode and result.resultMessage may vary based on different situations. For details, see the following Error codes section.

S

The store is added successfully.

The corresponding result.resultCode is SUCCESS and result.resultMessage is SUCCESS.

U

The status of the request to add the store is unknown.

The corresponding result.resultCode is UNKNOWN_EXCEPTION and result.resultMessage is "An API calling is failed, which is caused by unknown reasons.".

For details, see the Common error codes section.

F

Failed to add the store.

The corresponding result.resultCode and result.resultMessage may vary based on different situations. For details, see the following Error codes section.

Error codes

Error codes are usually classified into the following categories:

Samples

Request

copy
{
    "appId":"2102010113769***",
    "requestId": "0542f0f3a0c942a982c585e76bfe6f92",
    "stores": [
        {
            "storeInfo": {
                "areaId": "A39239",
                "storeId": "ST7956",
                "name": "Store D",
                "storeType": "HAWKER",
                "address": "Toy Centre,Road C,District B,City A,Country Z",
                "images": [
                    "https://www.example.com/iamges/cdZOWIR73/0011icon.jpg"
                ],
                "announcement": [
                    {
                        "contentType": "TEXT",
                        "value": "hello,this is Store D in Toy Hawker"
                    }
                ],
                "description": "Delicious food, Just for you",
                "location": {
                    "latitude": "30",
                    "longitude": "120",
                    "postCode": "999999"
                },
                "timeZone": "GMT+8:00",
                "cuisine": "ethnic food",
                "contactPhoneNos": [
                    "99999999"
                ],
                "pickUpAddress": "door one in TOY Centre",
                "pickUpContactDetails": [
                    {
                        "name": "Will",
                        "phoneNo": "9999999"
                    }
                ],
                "banners": [
                    {
                        "imageUrl": "https://www.example.com/images/antfincdn/dPRmkkfWX/0161icon.jpg",
                        "landingUrl": "https://www.example.com"
                    }
                ],
                "recommendItemIds": [
                    "singleitem789",
                    "singleitem3214"
                ]
            },
            "menus": [
                {
                    "menuInfo": {
                        "menuId": "055",
                        "storeId": "ST7956",
                        "menuType": "PICKUP",
                        "title": "Ali Shan",
                        "subTitle": "",
                        "description": "",
                        "pickUpRules": [
                            {
                                "endTime": "12:00",
                                "startTime": "10:00",
                                "step": "30",
                                "supportDays": 2,
                                "minPrepareMinutes": 15
                            },
                            {
                                "endTime": "17:00",
                                "startTime": "22:00",
                                "step": "30",
                                "supportDays": 2,
                                "minPrepareMinutes": 15
                            }
                        ]
                    },
                    "categories": [
                        {
                            "categoryInfo": {
                                "storeId": "ST7956",
                                "menuId": "055",
                                "categoryId": "005",
                                "title": "Others",
                                "subTitle": "",
                                "icon": "https://www.example.com/images/antfincdn/cdZOWIR73/0011icon.jpg"
                            },
                            "items": [
                                {
                                    "categoryId": "005",
                                    "itemInfo": {
                                        "quantityRule": {
                                            "min": 0,
                                            "max": 99
                                        },
                                        "itemTitle": "Stir Fried Hor Fun",
                                        "itemId": "singleitem123",
                                        "images": [
                                            "https://www.example.com/images/uploads/meals/0f61dfab72cf2de02248cee773f990ca.JPG"
                                        ],
                                        "priceInfo": {
                                            "originAmount": 120,
                                            "saleAmount": 100,
                                            "currency": "SGD"
                                        },
                                        "serviceAvailabilityList": [
                                            {
                                                "dayOfWeek": "MONDAY",
                                                "timePeriods": [
                                                    {
                                                        "description": "timePeriod desc",
                                                        "startTime": "10:00",
                                                        "endTime": "22:00"
                                                    }
                                                ]
                                            },
                                            {
                                                "dayOfWeek": "SUNDAY",
                                                "timePeriods": [
                                                    {
                                                        "description": "timePeriod desc",
                                                        "startTime": "10:59",
                                                        "endTime": "22:00"
                                                    }
                                                ]
                                            }
                                        ],
                                        "itemStatus": "AVAILABLE",
                                        "itemDescription": "delicious",
                                        "skuPropertyGroups": [
                                            {
                                                "propertyGroupName": "size",
                                                "propertyGroupKey": "27731",
                                                "properties": [
                                                    {
                                                        "propertyName": "Small",
                                                        "propertyValue": "Small"
                                                    },
                                                    {
                                                        "propertyName": "Large",
                                                        "propertyValue": "Large"
                                                    }
                                                ]
                                            },
                                            {
                                                "propertyGroupKey": "27733",
                                                "propertyGroupName": "Level of Spiciness",
                                                "properties": [
                                                    {
                                                        "propertyName": "No Chilli",
                                                        "propertyValue": "No Chilli"
                                                    },
                                                    {
                                                        "propertyName": "Less Chilli",
                                                        "propertyValue": "Less Chilli"
                                                    },
                                                    {
                                                        "propertyName": "Extra Chilli",
                                                        "propertyValue": "Extra Chilli"
                                                    },
                                                    {
                                                        "propertyName": "Normal Spicy",
                                                        "propertyValue": "Normal Spicy"
                                                    }
                                                ]
                                            }
                                        ],
                                        "skus": [
                                            {
                                                "image": "https://www.example.com/images/uploads/meals/0f62cf2de02248cee773f990ca.JPG",
                                                "priceInfo": {
                                                    "originAmount": 100,
                                                    "saleAmount": 90,
                                                    "currency": "SGD"
                                                },
                                                "skuId": "tsku2121",
                                                "skuPropertyPairs": {
                                                    "27731": "Small",
                                                    "27733": "Normal Spicy"
                                                }
                                            },
                                            {
                                                "image": "https://wwww.example.com/images/uploads/meals/2cf2dfssdmgkeqec1c.png",
                                                "priceInfo": {
                                                    "originAmount": 100,
                                                    "saleAmount": 80,
                                                    "currency": "SGD"
                                                },
                                                "skuId": "tsku2122",
                                                "skuPropertyPairs": {
                                                    "27731": "Large",
                                                    "27733": "Normal Spicy"
                                                }
                                            }
                                        ]
                                    },
                                    "modifierGroups": [
                                        {
                                            "modifierGroupInfo": {
                                                "groupName": "food main",
                                                "groupId": "tpgroup123",
                                                "quantityRule": {
                                                    "min": 0,
                                                    "max": 10
                                                }
                                            },
                                            "childItems": [
                                                {
                                                    "itemInfo": {
                                                        "itemTitle": "chicken",
                                                        "itemId": "addonItem256",
                                                        "itemStatus": "AVAILABLE",
                                                        "itemDescription": "",
                                                        "priceInfo": {
                                                            "saleAmount": 50,
                                                            "currency": "SGD"
                                                        }
                                                    },
                                                    "modifierGroups": [
                                                        {
                                                            "modifierGroupInfo": {
                                                                "groupName": "side dish",
                                                                "groupId": "tpgroup222",
                                                                "quantityRule": {
                                                                    "min": 0,
                                                                    "max": 1
                                                                }
                                                            },
                                                            "childItems": [
                                                                {
                                                                    "itemInfo": {
                                                                        "itemTitle": "lettuce",
                                                                        "itemId": "addonItem456",
                                                                        "itemStatus": "AVAILABLE",
                                                                        "itemDescription": "",
                                                                        "priceInfo": {
                                                                            "originAmount": 20,
                                                                            "saleAmount": 10,
                                                                            "currency": "SGD"
                                                                        }
                                                                    }
                                                                }
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Business rules for Store

The following code excerpts demonstrate the business rules of a store:

Specify delivery distance rule

copy
{
    "businessRule": [
        {
            "scene": "DELIVERY_DISTANCE",
            "ruleData": "[{\"from\":0,\"to\":5000,\"fee\":{\"currency\":\"SGD\",\"amountValue\":500},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"amountValue\":1000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":1000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"amountValue\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":100},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":3000}}]},{\"from\":5000,\"to\":10000,\"fee\":{\"currency\":\"SGD\",\"amountValue\":1000},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"amountValue\":2000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":2000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"amountValue\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":3000},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":4000}}]},{\"from\":10000,\"to\":100000,\"fee\":{\"currency\":\"SGD\",\"amountValue\":2000},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"amountValue\":5000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":5000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"amountValue\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":6000},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"amountValue\":7000}}]}]"
        }
    ]
}

Specify delivery schedule

copy
{
    "businessRule": [
        {
            "scene": "DELIVERY_SCHEDULE",
            "ruleData": "[{\"scheduleType\":\"WEEKLY\",\"supportDays\":30,\"schedules\":{\"MONDAY\":[{\"startTime\":\"10:00\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"TUESDAY\":[{\"startTime\":\"10:10\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"WEDNESDAY\":[{\"startTime\":\"10:20\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"THURSDAY\":[{\"startTime\":\"10:30\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"FRIDAY\":[{\"startTime\":\"10:40\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"SATURDAY\":[{\"startTime\":\"10:50\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"SUNDAY\":[{\"startTime\":\"11:00\",\"endTime\":\"11:30\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}]}}]"
        }
    ]
}

Specify pickup rule

copy
{
    "businessRule": [
        {
            "scene": "PICKUP_RULE",
            "ruleData": "[{\"minimumOrderAmount\":{\"currency\":\"SGD\",\"amountValue\":1800}}]"
        }
    ]
}

Specify pickup schedule

copy
{
    "businessRule": [
        {
            "scene": "PICKUP_SCHEDULE",
            "ruleData": "[{\"scheduleType\":\"WEEKLY\",\"supportDays\":30,\"schedules\":{\"MONDAY\":[{\"startTime\":\"10:00\",\"endTime\":\"12:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"TUESDAY\":[{\"startTime\":\"10:10\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"WEDNESDAY\":[{\"startTime\":\"10:20\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"THURSDAY\":[{\"startTime\":\"10:30\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"FRIDAY\":[{\"startTime\":\"10:40\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"SATURDAY\":[{\"startTime\":\"10:50\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"SUNDAY\":[{\"startTime\":\"11:00\",\"endTime\":\"11:30\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}]}}]"
        }
    ]
}

Specify dine-in order rule

copy
{
    "businessRule": [
        {
            "scene": "DINE_IN_ORDER",
            "ruleData": "{\"isTableNoRequired\": false,\"serviceType\": \"SERVE_TO_TABLE\"}"
        }
    ]
}

Specify dine-in schedule

copy
{
    "businessRule": [
        {
            "scene": "DINE_IN_SCHEDULE",
            "ruleData": "[{\"scheduleType\":\"WEEKLY\",\"supportDays\":31,\"schedules\":{\"MONDAY\":[{\"startTime\":\"09:00\",\"endTime\":\"12:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"TUESDAY\":[{\"startTime\":\"10:10\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"WEDNESDAY\":[{\"startTime\":\"10:20\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"THURSDAY\":[{\"startTime\":\"10:30\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"FRIDAY\":[{\"startTime\":\"10:40\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"SATURDAY\":[{\"startTime\":\"10:50\",\"endTime\":\"11:00\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}],\"SUNDAY\":[{\"startTime\":\"11:00\",\"endTime\":\"11:30\"},{\"startTime\":\"12:00\",\"endTime\":\"13:00\"},{\"startTime\":\"14:00\",\"endTime\":\"15:00\"},{\"startTime\":\"18:00\",\"endTime\":\"20:00\"},{\"startTime\":\"21:00\",\"endTime\":\"22:00\"}]}}]"
        }
    ]
}

Response

copy
{
    "result": {
        "resultCode": "SUCCESS",
        "resultStatus": "S",
        "resultMessage": "success"
    }
}