• 开发者平台
  • >
  • 餐饮文档中心

外卖下单收费

(下行接口)第三方合作方调用此接口,创建外卖订单(该接口中的金额全部是分为单位

请求描述

HTTP请求方式:POST
HTTP请求头类型:Content-Type=application/json
URI:   /open/v1/takeout/order/create

请求参数

1.公共参数

详情可查看【公共说明】中的公共参数模块

2.业务参数

参数名 类型 是否必填 参数描述
tpOrderId String 第三方订单号,门店下不能重复
needInvoice Int 是否需要发票, 1: 需要发票, 0:不需要发票,默认0
invoiceTitle String 发票抬头,需要发票时必传
invoicedAmount String 可开票金额,单位:分. 如果传入,则开票金额不能超过可开票金额
taxpayerId String 纳税人识别号,需要发票时必传
createTime Long 订单创建时间
status Int 订单状态, 已接受订单会直接触发云打印,1:待接单,2:已接单,默认1
remark String 订单备注,不支持emoji
peopleCount Int 就餐人数
shop Shop 店铺信息
products List<TakeoutProduct> 商品信息
delivery Delivery 配送信息
payment TakeoutPayment 支付信息
customers List<Customer> 顾客信息
discountDetails List<DiscountDetail> 优惠明细
isPrint Integer 是否打印:1打印,0不打印,为空默认打印类型为9:打印消费清单
printTemplateTypes Integer[] 8:后厨单,9:消费清单,15:标签; 都通过printTemplateTypes参数传递进来(9:参数不传递默认打印); 传递了isPrint:1,printTemplateTypes不传递,认为不打印; printTemplateTypes传递非正常类型,不处理
thirdSerialNo String 第三方取餐号
invoiceUrl String 发票地址url,长度不得超过500字符
takeMealBarcode String 后台出餐一维码,长度不得超过500字符

Shop

参数名 类型 是否必填 参数描述
shopIdenty Long 客如云门店ID
tpShopId String 合作方商户id
shopName String 合作方商户名称

TakeoutProduct

参数名 类型 是否必填 参数描述
name String 商品名称
id Long 客如云商品ID,为空按名字+规格匹配,无法匹配则当网络菜品处理
parentUuid String 套餐的子菜或单菜加料的父级uuid(即开发者自定义的订单中菜品唯一标识),如果是套餐子菜或单菜加料才有此值,单菜此字段不传
uuid String 订单中菜品的唯一标识,开发者自定义。如果菜品有加料或子菜,才需要传入此值,单菜无加料此值不传
type Integer 菜品类型 : 菜品种类 0:单菜 1:套餐 2:加料。套餐子菜请填0
tpId String 合作方商品ID
quantity Int 份数
unit String 菜品单位
price Int 商品单价,单位:分
packagePrice Int 餐盒单价,单位:分
packageQuantity Int 餐盒数量
packName String 口袋名称
totalFee Int 商品总额=(菜品单价 + 变价) * 商品数量,单位:分
properties List<ProductProperty> 商品规格属性
remark String 订单备注

ProductProperty

参数名 类型 是否必填 参数描述
name String 菜品属性名称
id Long 菜品属性ID, 为空就匹配名字,名字也无法匹配则放到备注
type Int 属性类型1:做法 2:标签 3:备注 4:规格
reprice Int 变价, 单位:分,正数加价,负数减价,type为做法此字段必填

Delivery

参数名 类型 是否必填 参数描述
expectTime Long 期望送达时间,自提预约取货,时间戳,精确到秒,为0则立即送餐
deliveryParty Int 配送方式,1:商家自配(商户自己配送或通过客如云接入的第三方配送平台),2:平台配送,3:自提
receiverName String 收货人姓名,不支持特殊表情
receiverPhone String 收货人电话
receiverGender Int 收货人性别,0:女,1:男,-1:未知,默认1
delivererName String 配送员
delivererPhone String 配送员电话
delivererAddress String 送货地址,商家自配送不能为空
coordinateType Int 经纬度类型,商家自配送不能为空,1:百度,2:高德
longitude Double 送餐地址经度(0~180),商家自配送不能为空
latitude Double 送餐地址维度(0~90),商家自配送不能为空

TakeoutPayment

参数名 类型 是否必填 参数描述
memberId Long 会员customerId,对应登录会员与会员详情接口中的customerId(如果用会员支付,此字段必传)
promotionId String 券id,只能支付方式是优惠券支付的时候,才填写
memberCardNumber Int 卡号
memberPassword Int 密码,需md5加密(如果要用会员余额支付,此字段必传)
totalFee Long 订单总价,订单总价=商品总金额+餐盒费+配送费,单位:分
deliveryFee Int 配送费,单位:分
packageFee Int 餐盒费,餐盒费=餐盒数量 * 餐盒单价, 单位:分
discountFee Int 优惠总金额,优惠总金额=平台优惠总金额+商户优惠总金额,单位:分
platformDiscountFee Int 平台优惠总金额,单位:分
shopDiscountFee Int 传discountDetails时:商户优惠总金额=商家优惠+客如云优惠券总额,单位:分 不传discountDetails时: 商家优惠
shopFee Int 商户实收总价,订单来源方配送/平台配送商户实收=订单总价-商家承担优惠金额-服务费-配送费+补贴,商家自配送商户实收=订单总价-商家承担优惠金额-服务费+补贴,自提商户实收=订单总价-商家承担优惠金额-服务费+补贴,单位:分 注:若优惠金额>订单总价,该字段请传0
userFee Int 用户实付总价,用户实付=订单总价-优惠总金额,单位:分 注:若优惠金额>订单总价,该字段请传0
serviceFee Int 服务费(商户向平台支付的佣金等),单位:分
subsidies Int 平台补贴(第三方平台每单给与商家的补贴),单位:分
payType Int 支付方式 1:线下支付/货到付款 2:在线支付 3:会员卡余额 4:优惠券

Customer

参数名 类型 是否必填 参数描述
id Long 会员customerId
phoneNumber String 会员电话
name String 会员姓名,不支持表情符,请自行处理
gender Int 会员性别

DiscountDetail

参数名 类型 是否必填 参数描述
discountType Int 优惠类型 1:客如云优惠券(目前仅支持代金券,并且优惠券金额必须要大于等于订单总价) 2:平台优惠 3:商家优惠  
discountFee Int 优惠金额
promotionId Long 优惠活动或者优惠券id,如果优惠类型是优惠券必传
couponId Long 优惠券模板id, 如果优惠类型是优惠券必传
customerId Long 会员customerId, 如果优惠类型是优惠券必传,而且必须和DinnerOrderMember中至少一个id一致
description String 优惠描述

业务示例(JSON)

场景一:无加料无子菜的情况

{
    "tpOrderId":"123123123131",
    "needInvoice":1,
    "invoiceTitle":"我要发票,这是抬头",
    "createTime":1491906548372,
    "peopleCount":1,
    "remark":"呵呵",
    "shop":{
        "shopIdenty":247900001,
        "tpShopId":"247900001",
        "shopName":"南粉北面高攀路店面"
    },
    "products":[
        {
            "name":"土豆丝炒肉肉",
            "id":298372,
            "tpId":"24242",
            "quantity":2,
            "price":1,
            "packagePrice":0,
            "packageQuantity":2,
            "totalFee":2,
            "remark":"炒软一点",
            "packName":"口袋1"
        }
    ],
    "delivery":{
        "expectTime":0,
        "deliveryParty":1,
        "receiverName":"12345678901",
        "receiverPhone":"12345678901",
        "receiverGender":1,
        "delivererPhone":"13112222222",
        "delivererAddress":"四川成都",
        "coordinateType":1,
        "longitude":88,
        "latitude":110
    },
    "payment":{
        "deliveryFee":0,
        "packageFee":0,
        "discountFee":0,
        "platformDiscountFee":0,
        "shopFee":2,
        "userFee":2,
        "serviceFee":0,
        "subsidies":0,
        "totalFee":2,
        "payType":2
    },
    "isPrint": 1,
    "printTemplateTypes":[9],
    "invoiceUrl":"https://www.baidu.com",
    "takeMealBarcode":"654001001"
}

场景二:有加料的情况(如:点两份相同的奶茶,加料不同,那么两份奶茶的uuid需定义成不相同的,加料的商品中parentUuid分别填写需要加的奶茶的uuid)

{
    "tpOrderId":"123123123131",
    "needInvoice":1,
    "invoiceTitle":"我要发票,这是抬头",
    "createTime":1491906548372,
    "peopleCount":1,
    "remark":"呵呵",
    "shop":{
        "shopIdenty":247900001,
        "tpShopId":"247900001",
        "shopName":"南粉北面高攀路店面"
    },
    "products":[
        {
             "name": "满满鲜奶茶",
                "id": 218063455586880512,
            "tpId":"24242",
            "uuid":12345,
            "quantity":1,
            "price":200,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温 ",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        {
             "name": "满满鲜奶茶",
                "id": 218063455586880512,
            "tpId":"24242",
            "uuid":123456,
            "quantity":1,
            "price":200,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        { "name": "加料1",
                "id": "",
            "tpId":"24242",
            "parentUuid":123456,
            "quantity":1,
            "price":0,
            "type":2,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0},
            { "name": "配料1",
                "id": "",
            "tpId":"24242",
            "parentUuid":12345,
            "quantity":1,
            "price":0,
            "type":2,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0}
    ],
    "delivery":{
        "expectTime":0,
        "deliveryParty":1,
        "receiverName":"12345678901",
        "receiverPhone":"12345678901",
        "receiverGender":1,
        "delivererPhone":"13112222222",
        "delivererAddress":"四川成都",
        "coordinateType":1,
        "longitude":88,
        "latitude":110
    },
    "payment":{
        "deliveryFee":0,
        "packageFee":0,
        "discountFee":0,
        "platformDiscountFee":0,
        "shopFee":400,
        "userFee":400,
        "serviceFee":0,
        "subsidies":0,
        "totalFee":400,
        "payType":2
    },
    "isPrint": 1,
    "printTemplateTypes":[9]
}

场景三:套餐有子菜的情况

{
    "tpOrderId":"123123123131",
    "needInvoice":1,
    "invoiceTitle":"我要发票,这是抬头",
    "createTime":1491906548372,
    "peopleCount":1,
    "remark":"呵呵",
    "shop":{
        "shopIdenty":247900001,
        "tpShopId":"247900001",
        "shopName":"南粉北面高攀路店面"
    },
    "products":[
        {
             "name": "满满鲜奶茶",
                "id": 218063455586880512,
            "tpId":"24242",
            "uuid":12345,
            "quantity":1,
            "price":200,
            "type":1,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温 ",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        {
             "name": "满满鲜奶茶",
                "id": 218063455586880512,
            "tpId":"24242",
            "uuid":123456,
            "quantity":1,
            "price":200,
            "type":1,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":200,
            "properties":[
                {
                    "name":"五分甜",
                    "type":1,
                    "reprice":0
                }, {
                    "name":"常温",
                    "type":1,
                    "reprice":0
                }
            ]
        },
        { "name": "加料1",
                "id": "",
            "tpId":"24242",
            "parentUuid":123456,
            "quantity":1,
            "price":0,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0},
            { "name": "配料1",
                "id": "",
            "tpId":"24242",
            "parentUuid":12345,
            "quantity":1,
            "price":0,
            "type":0,
            "packagePrice":0,
            "packageQuantity":0,
            "totalFee":0}
    ],
    "delivery":{
        "expectTime":0,
        "deliveryParty":1,
        "receiverName":"12345678901",
        "receiverPhone":"12345678901",
        "receiverGender":1,
        "delivererPhone":"13112222222",
        "delivererAddress":"四川成都",
        "coordinateType":1,
        "longitude":88,
        "latitude":110
    },
    "payment":{
        "deliveryFee":0,
        "packageFee":0,
        "discountFee":0,
        "platformDiscountFee":0,
        "shopFee":400,
        "userFee":400,
        "serviceFee":0,
        "subsidies":0,
        "totalFee":400,
        "payType":2
    },
    "isPrint": 1,
    "printTemplateTypes":[9]
}

响应参数

参数名 类型 是否必填 参数描述
code Int 错误码;0:成功;其他详见错误码
message String 错误说明
messageUuid String 消息uuid
result Object 返回业务参数 code !=0的情况下不返回业务参数

result

参数名 类型 是否必填 参数描述
orderId String 开放平台订单id
tradeId String 订单id
serialNumber int 订单序号
pickUpNumber String 自定义取餐号

响应示例(JSON)

{
    "result": {
        "orderId": "ff0828bb91ba4dbd8cfb901657a393e6",
        "tradeId": 268433446903745536,
        "serialNumber": "70"
    },
    "code": 0,
    "message": "成功[OK]",
    "messageUuid": "b1d93c0b45b04ad6b056d64f22bc67d7",
    "apiMessage": null
}
目录