consult

POST /v2/pds/order/consult

This API is used by D-store Platform to request the SaaS provider or ISV to calculate order price.

The message structure of this API is defined by D-store Platform. Follow the specifications below when the SaaS provider or ISV develops this API.

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

requestId

String

Yes

Indicates the unique ID assigned by D-store Platform to identify a consultation request.

  • Maximum length: 255 characters

Note: This field is an API idempotency field. For the consult requests that are initiated with the same requestId value, the SaaS provider or ISV must return the same result. For details about API idempotency, see the Idempotency chapter.

"a4923bbb-667a-40cb-ab04-2a49c76a****"

orderItems

Array<OrderItem>

Yes

Indicates a list of the order items.

Maximum size: 120 elements

-

orderType

String

Yes

Indicates the type of the order.

Valid values are:

  • PICKUP: Order that is picked up by users themselves.
  • DINEIN: Order that is consumed in the restaurant where it is ordered.
  • DELIVERY: Order that is delivered to a specific location.

"PICKUP"

orderTime

Datetime

Yes

Indicates the fulfillment time of the order, including the following three scenarios:

  • When the value of orderType is PICKUP, this parameter indicates the time when the user expects to collect the order.
  • When the value of orderType is DELIVERY, this parameter indicates the time when the user expects to receive the order.
  • When the value of orderType is DINEIN, this parameter indicates the time when the user expects to consume the order in the restaurant.

The value follows the ISO 8601 standard format.

"2023-01-03T21:00:00+08:00"

userInfo

UserInfo

No

Indicates the information about the user.

Note: This parameter is required when the value of orderType is DELIVERY.

-

sellerInfo

SellerInfo

No

Indicates the information about the merchant.

-

extendInfo

Map<String,String>

No

Indicates the extended information about this API.

  • Maximum length: 2048 characters

Note:

  • merchantPromotions: indicates the promotion information of the merchant. This parameter is in JSON format containing a PromoDetail object.
  • pointsRedemptionAmount: indicates the amount of money the user redeems with their reward points. This parameter is in JSON format containing an Amount object.

-

Response parameters

Field

Data type

Required

Description

result

Result

Yes

Indicates the request result such as status and error codes.

consultId

String

No

Indicates the unique ID assigned by the SaaS provider or ISV to identify a consultation.

Maximum length: 255 characters

Note: When this parameter is returned, D-store Platform will pass this parameter and its associated value to the SaaS provider or ISV in the createOrder API call. The SaaS provider or ISV can verify whether the consultId parameter is valid to determine the validity of the consultation.

amountDetail

ConsultOrderAmountDetail

Yes

Indicates the amount details of the order.

extendInfo

Map<String,String>

No

Indicates the extended information about the response.

Maximum length: 2048 characters

How to return the result

Follow the instructions below to return the result (specified in the result parameter) according to your business processing results:

  • If the request is successful, set the value of result.resultStatus to S and the value of result.resultCode to SUCCESS.
  • If the status of the request is unknown, set the value of result.resultStatus to U and the value of result.resultCode to UNKNOWN_EXCEPTION.
  • If the request failed, set the value of result.resultStatus to F and specify the value of result.resultCode according to the failure reason.

For more information about how to define your result codes, see Result codes.

Result codes

Check the following table for possible result codes:

Result code

Result status

Result message

SUCCESS

S

Success.

UNKNOWN_EXCEPTION

U

An API calling is failed, which is caused by unknown reasons.

PROCESS_FAIL

F

A general business failure occurred. Do not retry.

PARAM_ILLEGAL

F

Illegal parameters. For example, non-numeric input, invalid date.

INVALID_API

F

The called API is invalid or not active.

ACCESS_DENIED

F

Access is denied.

REQUEST_TRAFFIC_EXCEED_LIMIT

F

The request traffic exceeds the limit.

Samples

Request

copy
{
    "requestId": "a4923bbb-667a-40cb-ab04-2a49c76a****",
    "orderItems": [
        {
            "categoryId": "category02_1206_01",
            "itemId": "itemid_02_1206_01",
            "modifierGroupDetails": " [{\"groupId\":\"modifier_group_01\",\"itemDetail\":[{\"itemId\":\"item_02\",\"priceInfo\":{\"currency\":\"SGD\",\"originAmount\":190,\"saleAmount\":180},\"quantity\":1,\"requestSubOrderId\":\"\",\"storeId\":\"store_01\"},{\"itemId\":\"item_03\",\"quantity\":1,\"requestSubOrderId\":\"\",\"storeId\":\"store_01\"}]}]",
            "modifierGroupDetailObjects": [
                {
                    "groupId": "modifier_group_01",
                    "itemDetail": [
                        {
                            "itemId": "item_02",
                            "priceInfo": {
                                "currency": "SGD",
                                "originAmount": 30,
                                "saleAmount": 20
                            },
                            "quantity": 1,
                            "requestSubOrderId": "",
                            "storeId": "store_01"
                        }
                    ]
                }
            ],
            "notAvailableOption": "Remove it from my order",
            "priceInfo": {
                "currency": "SGD",
                "originAmount": 1190,
                "saleAmount": 1180
            },
            "quantity": 1,
            "skuId": "sku_03",
            "storeId": "store_01"
        }
    ],
    "orderType": "PICKUP",
    "orderTime": "2023-01-03T21:00:00+08:00",
    "userInfo": {
        "userName": "test**Name",
        "userPhone": "+86156****721",
        "userAddress": "mock user address",
        "userLatitude": "11.3548791",
        "userLongitude": "13.8308643",
        "userPostCode": "574408"
    },
    "sellerInfo": {
        "sellerStoreId": "2022120611151100021000620064****",
        "sellerName": "1206_01store",
        "sellerPhone": "+86183****678",
        "sellerAddress": "mock seller address",
        "sellerLatitude": "1.3548791",
        "sellerLongitude": "103.8308643",
        "sellerPostCode": "574408"
    },
    "extendInfo": {
        "merchantPromotions": "",
        "pointsRedemption": ""
    }
}

Response

copy
{
    "consultId": "0F17-426ad36f-2ffb-4e18-b45e-af67663b****",
    "amountDetail": {
        "totalAmount": {
            "currency": "SGD",
            "value": 1910
        },
        "itemFeeAmount": {
            "currency": "SGD",
            "value": 1800
        },
        "takeawayFeeAmount": {
            "currency": "SGD",
            "value": 80
        },
        "deliveryFeeAmount": {
            "currency": "SGD",
            "value": 20
        },
        "taxAmount": {
            "currency": "SGD",
            "value": 10
        },
        "taxSeparatelyCharged": true,
        "serviceChargeAmount": {
            "currency": "SGD",
            "value": 0
        },
        "handlingFeeAmount": {
            "currency": "SGD",
            "value": 0
        },
        "tipsAmount": {
            "currency": "SGD",
            "value": 0
        },
        "roundAmount": {
            "currency": "SGD",
            "value": 0
        },
        "smallOrderFeeAmount": {
            "currency": "SGD",
            "value": 0
        },
        "extendInfo": {}
    },
    "extendInfo": {},
    "result": {
        "resultCode": "SUCCESS",
        "resultMessage": "success",
        "resultStatus": "S"
    }
}