Support delivery

This topic demonstrates the implementations of the syncStore API to support the delivery service in a store.

Overview

In the food and beverage industry, a store can configure different service types, including:

  • Dine-in: Users dine in the eatery.
  • Pickup: Users pick up the food themselves.
  • Delivery: Users have their food delivered to a specific destination.

To support delivery, you need to include the following delivery-related configurations in a store:

  • Include a delivery menu. The value of the menus.type parameter is DELIVERY.
  • Contain the business rules for delivery in the store.bizRules parameter. The value of the store.bizRules.scene parameter is DELIVERY_SCHEDULE or DELIVERY_DISTANCE.
  • When the value of the store.bizRules.scene parameter is DELIVERY_SCHEDULE, make sure the ruleData parameter contains available schedules during the store's opening hours and specify the supportDays parameter with a value ranging from 1 to 30.
  • When the value of the store.bizRules.scene parameter is DELIVERY_DISTANCE, see FeeRule for specific configurations.

Note: To specify the availability of dine-in, pickup, or delivery services, see Set service availability.

Use cases

Add a store that supports delivery

The following example demonstrates a store that supports delivery:

  • The store opens from 8:00-23:00 every day.
  • The store supports delivery and the delivery service is available from 10:00-11:00 and 12:00-13:00.
  • The value of supportDays is 6, which means users can see a 6-day schedule for the delivery service every day.

copy
{
    "requestId": "12222211****",
    "store": {
        "storeId": "deliverystoreid01",
        "type": "RESTAURANT",
        "brandId": "Test Brand",
        "name": {
            "value": {
                "en-US": "AAdine01"
            }
        },
        "location": {
            "address": {
                "value": {
                    "en-US": "123 Braddell Tech, Lorong 8 Toa Payoh #12-14, 319123, Singapore"
                }
            },
            "latitude": "1.339953",
            "longitude": "103.858048"
        },
        "status": "OPEN",
        "contacts": [
            {
                "name": {
                    "value": {
                        "en-US": "will"
                    }
                },
                "phoneNo": "+86130******"
            }
        ],
        "contents": [
            {
                "type": "TEXT",
                "scene": "ANNOUNCEMENT",
                "value": "{\"value\":{\"en-US\":\"store abc\"}}"
            },
            {
                "type": "IMAGE",
                "scene": "BACKGROUND",
                "value": "https://omni.storeabc.com/Omni_FnbItem/store1/test.png"
            },
            {
                "type": "TEXT",
                "scene": "DESCRIPTION",
                "value": "{\"value\":{\"en-US\":\"store01\"}}"
            }
        ],
        "serviceSchedules": [
            {
                "scheduleType": "DAILY",
                "schedules": {
                    "FIXED": [
                        {
                            "startTime": "08:00+08:00",
                            "endTime": "23:00+08:00"
                        }
                    ]
                }
            }
        ],
        "bizRules": [
            {
                "scene": "DELIVERY_SCHEDULE",
                "ruleData": "[{\"scheduleType\":\"DAILY\",\"supportDays\":6,\"schedules\":{\"FIXED\":[{\"startTime\":\"10:00+08:00\",\"endTime\":\"11:00+08:00\"},{\"startTime\":\"12:00+08:00\",\"endTime\":\"13:00+08:00\"}]}}]"
            },
            {
                "scene": "DELIVERY_DISTANCE",
                "ruleData": "[{\"from\":0,\"to\":5000,\"fee\":{\"currency\":\"SGD\",\"value\":500},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"value\":1000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":1000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"value\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":100},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":3000}}]},{\"from\":5000,\"to\":10000,\"fee\":{\"currency\":\"SGD\",\"value\":1000},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"value\":2000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":2000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"value\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":3000},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":4000}}]},{\"from\":10000,\"to\":100000,\"fee\":{\"currency\":\"SGD\",\"value\":2000},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"value\":5000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":5000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"value\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":6000},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":7000}}]}]"
            }
        ],
        "menus": [
            {
                "menuId": "menu_id_02",
                "name": {
                    "value": {
                        "en-US": "Beakfast"
                    }
                },
                "status": "VALID",
                "type": "DELIVERY",
                "minPrepareMinutes": 15,
                "categories": [
                    {
                        "categoryId": "category_id_02",
                        "name": {
                            "value": {
                                "en-US": "Limited Time Offer"
                            }
                        },
                        "iconUrl": "https://www.example.com/images/antfincdn/cdZOWIR73/0011icon.jpg",
                        "status": "ACTIVE",
                        "extendInfo": {
                            "subtitle": {
                                "value": {
                                    "en-US": "Main Course"
                                }
                            }
                        },
                        "items": [
                            {
                                "itemId": "item01",
                                "name": {
                                    "value": {
                                        "en-US": "Nachos Deluxe Double Beef"
                                    }
                                },
                                "status": "AVAILABLE",
                                "saleType": "SINGLE",
                                "originAmount": {
                                    "currency": "SGD",
                                    "value": "30000"
                                },
                                "saleAmount": {
                                    "currency": "SGD",
                                    "value": "1350"
                                },
                                "quantityRule": {
                                    "min": 0,
                                    "max": 99
                                },
                                "contents": [
                                    {
                                        "type": "IMAGE",
                                        "scene": "BACKGROUND",
                                        "value": "https://omni.posplus-crm.com/Omni_FnbItem/storeabc/NSDLX_DBBF_AC.png"
                                    },
                                    {
                                        "type": "TEXT",
                                        "scene": "DESCRIPTION",
                                        "value": "{\"value\":{\"en-US\":\"For those who prefer a cheesy meal, indulge in our Nachos Deluxe Double Beef. Served with two beef patties, American cheese, lettuce and a combination of different sauces such as mayonnaise, ketchup and Nachos Cheese sauce!\"}}"
                                    }
                                ],
                                "modifierGroups": [
                                    {
                                        "groupId": "MODIFIERGROUP-1",
                                        "name": {
                                            "value": {
                                                "en-US": "Add-On"
                                            }
                                        },
                                        "quantityRule": {
                                            "min": 0,
                                            "max": 12
                                        },
                                        "childItems": [
                                            {
                                                "itemId": "addonitem01",
                                                "name": {
                                                    "value": {
                                                        "en-US": "Add Beef Patty"
                                                    }
                                                },
                                                "saleType": "ADDON",
                                                "originAmount": {
                                                    "currency": "SGD",
                                                    "value": 0
                                                },
                                                "saleAmount": {
                                                    "currency": "SGD",
                                                    "value": 350
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

Add delivery service to an existing store

The following example demonstrates adding the delivery service to an existing store (deliverystoreid01).

Note: To add the delivery-related rules, pass a new bizRules array with existing and newly added rules, which will overwrite the data in the previous array.

copy
{
    "requestId": "12222211****",
    "store": {
        "storeId": "deliverystoreid01",
        "bizRules": [
            {
                "scene": "DELIVERY_SCHEDULE",
                "ruleData": "[{\"scheduleType\":\"DAILY\",\"supportDays\":6,\"schedules\":{\"FIXED\":[{\"startTime\":\"10:00+08:00\",\"endTime\":\"11:00+08:00\"},{\"startTime\":\"12:00+08:00\",\"endTime\":\"13:00+08:00\"}]}},{\"startTime\":\"2022-10-01T00:00:01+08:00\",\"endTime\":\"2022-10-10T00:00:01+08:00\",\"scheduleType\":\"DAILY\",\"supportDays\":6,\"schedules\":{\"FIXED\":[{\"startTime\":\"11:00+08:00\",\"endTime\":\"12:00+08:00\"},{\"startTime\":\"13:00+08:00\",\"endTime\":\"14:00+08:00\"}]}}]"
            },
            {
                "scene": "DELIVERY_DISTANCE",
                "ruleData": "[{\"from\":0,\"to\":5000,\"fee\":{\"currency\":\"SGD\",\"value\":500},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"value\":1000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":1000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"value\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":100},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":3000}}]},{\"from\":5000,\"to\":10000,\"fee\":{\"currency\":\"SGD\",\"value\":1000},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"value\":2000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":2000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"value\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":3000},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":4000}}]},{\"from\":10000,\"to\":100000,\"fee\":{\"currency\":\"SGD\",\"value\":2000},\"minimumOrderAmount\":{\"currency\":\"SGD\",\"value\":5000},\"discounts\":[{\"discountType\":\"REDUCE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":5000},\"discountValue\":\"{\\\"currency\\\": \\\"SGD\\\", \\\"value\\\":1000}\"},{\"discountType\":\"PERCENTAGE\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":6000},\"discountValue\":\"20\"},{\"discountType\":\"EXEMPTION\",\"orderThresholdAmount\":{\"currency\":\"SGD\",\"value\":7000}}]}]"
            }
        ],
        "menus": [
            {
                "menuId": "menu_id_02",
                "name": {
                    "value": {
                        "en-US": "Beakfast"
                    }
                },
                "status": "VALID",
                "type": "DELIVERY",
                "minPrepareMinutes": 15,
                "categories": [
                    {
                        "categoryId": "category_id_02",
                        "name": {
                            "value": {
                                "en-US": "Limited Time Offer"
                            }
                        },
                        "iconUrl": "https://www.example.com/images/antfincdn/cdZOWIR73/0011icon.jpg",
                        "status": "ACTIVE",
                        "extendInfo": {
                            "subtitle": {
                                "value": {
                                    "en-US": "Main Course"
                                }
                            }
                        },
                        "items": [
                            {
                                "itemId": "item01",
                                "name": {
                                    "value": {
                                        "en-US": "Nachos Deluxe Double Beef"
                                    }
                                },
                                "status": "AVAILABLE",
                                "saleType": "SINGLE",
                                "originAmount": {
                                    "currency": "SGD",
                                    "value": "30000"
                                },
                                "saleAmount": {
                                    "currency": "SGD",
                                    "value": "1350"
                                },
                                "quantityRule": {
                                    "min": 0,
                                    "max": 99
                                },
                                "contents": [
                                    {
                                        "type": "IMAGE",
                                        "scene": "BACKGROUND",
                                        "value": "https://omni.posplus-crm.com/Omni_FnbItem/storeabc/NSDLX_DBBF_AC.png"
                                    },
                                    {
                                        "type": "TEXT",
                                        "scene": "DESCRIPTION",
                                        "value": "{\"value\":{\"en-US\":\"For those who prefer a cheesy meal, indulge in our Nachos Deluxe Double Beef. Served with two beef patties, American cheese, lettuce and a combination of different sauces such as mayonnaise, ketchup and Nachos Cheese sauce!\"}}"
                                    }
                                ],
                                "modifierGroups": [
                                    {
                                        "groupId": "MODIFIERGROUP-1",
                                        "name": {
                                            "value": {
                                                "en-US": "Add-On"
                                            }
                                        },
                                        "quantityRule": {
                                            "min": 0,
                                            "max": 12
                                        },
                                        "childItems": [
                                            {
                                                "itemId": "addonitem01",
                                                "name": {
                                                    "value": {
                                                        "en-US": "Add Beef Patty"
                                                    }
                                                },
                                                "saleType": "ADDON",
                                                "originAmount": {
                                                    "currency": "SGD",
                                                    "value": 0
                                                },
                                                "saleAmount": {
                                                    "currency": "SGD",
                                                    "value": 350
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}