目录

13.0订单数据推送

优质
小牛编辑
131浏览
2023-12-01
通讯方式:
通讯采用HTTP(S)协议,POST方式发生json格式的报文
json格式请求:
Content-Type:application/json;charset=utf-8
json格式返回:

Content-Type:application/json;charset=utf-8

返回响应说明:

商户处理后同步返回给果盘参数:{"status":1,"info":"返回信息"} json格式 //注:状态码返回非1或异常,即触发推送重试机制,最大推送次数:3次

//status:返回状态码1=成功;0=失败 info:返回信息

签名算法:

签名生成的通用步骤如下:

第一步,将POST参数(msid、timestamp、nonce、signtype、data)按照参数名ASCII码从小到大排序(字典序),使用URL键值对的格式(即key1=value1&key2=value2…)拼接成字符串stringA。

第二步,在stringA最后通过(半角逗号)拼接上开发商apikey得到stringSignTemp字符串,并对stringSignTemp进行sha1加密运算,得到sign值signValue

◆ 开发商apikey:果盘代理商后台-->开发管理-->APP应用管理-->对应应用ID的应用秘钥appsecret

举例:
假设推送URI地址:https://wx.dc78.cn/api/callBackUrl?sign=9A0A8659F005D6984697E2CA0A9CF3B7

传送的POST参数如下:

msid:6786

timestamp:20200320114702

nonce:45645

signtype:sha1

data:{"status":1,"id":"186200010000038842","msid":"6786","time":"2020-03-20 09:40:22","date":"20200320","type":"1","cate":"20","state":"2","count":"0","table":"001","cfmtime":"2020-03-20 09:40:06","cfmcode":""}

第一步:对参数按照key=value的格式,并按照参数名ASCII字典序排序如下:

stringA="data={"status":1,"id":"186200010000038842","msid":"6786","time":"2020-03-20 09:40:22","date":"20200320","type":"1","cate":"20","state":"2","count":"0","table":"001","cfmtime":"2020-03-20 09:40:06","cfmcode":""}&msid=6786&nonce=45645&signtype=sha1&timestamp=20200320114702";

第二步:拼接开发商apikey密钥:(注意:apikey为分配给对应推送商户的gpid应用详情中的应用秘钥)

stringSignTemp=stringA+",192006250b4c09247ec02edce69f6a2d"//注:apiley为开发商后台分配是apikey

sign=sha1(stringSignTemp)="9A0A8659F005D6984697E2CA0A9CF3B7"//注:sha1签名方式

请求参数说明

参数描述必填示例值类型最大长度

请求示例

{
}

响应参数说明

参数描述必填示例值类型最大长度
status返回状态。接口成功时为1,出错为01number
id订单的唯一编号186200010000038842number
msid门店编号6786number
time订单时间2020-03-20 09:40:22string
date订单业务日期20200320number
type类选0=堂食,1=外卖number
cate订单业务分类10=堂食,11=打包,12=预点,20=外卖,21=外卖自提number
phone客人手机号17086263907,765string
cust客人姓名张**string
state订单状态(1=下单成功,6=订单已配送,-1=退单,-2=部分退)1number
count0number
table订单桌台名称001number
cfmtime确认下单时间2020-03-20 09:40:06string
cfmcode确认人工号string
cfmuser确认人string
pscount人数1number
memo订单备注(饿了么#38)string
addr订单地址(外卖业务)天泰金融广场B座深圳路222号 3106string
payid支付单id。先付模式下订单已支付,会有订单 id。为0说明未支付(后付)。已支付外卖订单为11number
paytype支付类型1=货到付款,2=在线支付number
src订单来源el=饿了么,mt=美团string
srcid外卖平台订单号21197015974876213008number
num订单序号38number
srcnum订单流水号描述饿了么#38string
wishtime预约时间string
chucfs出菜方式string
rider_id菜品外部代码string
rider_phone骑手电话string
rider_name骑手名称string
package_numstring
route路线string
mbid平台idstring
mbaccid微会员idstring
mbcardno会员卡号string
invoice是否单独推送发票信息(设置该参数备注( memo字段)与发票信息( invoice字段)分别单独显示,不设置invoice参数,默认将发票和备注信息合并到( memo字段)显示)string
pay_amt外卖平台客人实付金额(外卖官方接口支持)24number
list订单中的明细列表list
└id明细 id1number
└name名称加蛋牛肉粉string
└price价格14number
└refid门店菜品id01003number
└unit单位string
└qty数量1number
└amt金额14number
└memo备注string
└dgid平台菜品id5486366number
└parentid套餐明细标识0number
└rebate折扣0number
└cartid外卖平台订单口袋id33number
└cartname外卖平台订单口袋名称333333number
other_pay_item外卖平台扩展参数信息支持,配送费、打包费、外卖平台佣金、外卖平台活动费、替用户承担配送费会在这个item线下可以自行处理需要的参数(开放需申请)list
└name名称打包费string
└price价格2number
└refid门店菜品id99902number
└unit单位string
└qty数量1number
└amt金额2number
└memo备注string
└dgid平台菜品id2number

响应示例

{
	"status": 1,
	"id": "186200010000038842",
	"msid": "6786",
	"time": "2020-03-20 09:40:22",
	"date": "20200320",
	"type": "1",
	"cate": "20",
	"phone": "17086263907,765",
	"cust": "张**",
	"state": "2",
	"count": "0",
	"table": "001",
	"cfmtime": "2020-03-20 09:40:06",
	"cfmcode": "",
	"cfmuser": null,
	"pscount": "1",
	"memo": "(饿了么#38)",
	"addr": "天泰金融广场B座深圳路222号 3106",
	"payid": "1",
	"paytype": "2",
	"src": "el",
	"srcid": "21197015974876213008",
	"num": 38,
	"srcnum": "饿了么#38",
	"wishtime": "",
	"chucfs": null,
	"rider_id": null,
	"rider_phone": null,
	"rider_name": null,
	"package_num": null,
	"route": null,
	"mbid": null,
	"mbaccid": "",
	"mbcardno": "",
	"invoice": "",
	"pay_amt": 24,
	"list": [{
			"id": "1",
			"name": "加蛋牛肉粉",
			"price": 14,
			"refid": "01003",
			"unit": "份",
			"qty": 1,
			"amt": 14,
			"memo": "",
			"dgid": 5486366,
			"parentid": 0,
			"rebate": "0",
			"cartid": "33",
			"cartname": "333333"
		},
		{
			"id": "2",
			"name": "拌海带丝",
			"price": 5,
			"refid": "02005",
			"unit": "份",
			"qty": 1,
			"amt": 5,
			"memo": "",
			"dgid": 5486379,
			"parentid": 0,
			"rebate": "0",
			"cartid": "44",
			"cartname": "444444"
		},
		{
			"id": "3",
			"name": "打包费",
			"price": 2,
			"refid": "99902",
			"unit": "单",
			"qty": 1,
			"amt": 2,
			"memo": "",
			"dgid": 2,
			"parentid": 0,
			"rebate": "0",
			"cartid": "",
			"cartname": ""
		},
		{
			"id": "4",
			"name": "平台费",
			"price": -4,
			"refid": "99911",
			"unit": null,
			"qty": 1,
			"amt": -4,
			"memo": "",
			"dgid": 11,
			"parentid": 0,
			"rebate": "0",
			"cartid": "",
			"cartname": ""
		}
	],
	"other_pay_item": [{
			"name": "打包费",
			"price": 2,
			"refid": "99902",
			"unit": "元",
			"qty": 1,
			"amt": 2,
			"memo": "",
			"dgid": 2
		},
		{
			"name": "平台费",
			"price": -4,
			"refid": "99911",
			"unit": "元",
			"qty": 1,
			"amt": -4,
			"memo": "",
			"dgid": 11
		},
		{
			"name": "配送费",
			"price": 3,
			"refid": "99901",
			"unit": "元",
			"qty": 1,
			"amt": 3,
			"memo": "",
			"dgid": 1
		}
	]
}

说明

外卖订单中的配送费与打包费的编码如下:

编码名称
99901
配送费
99902
打包费
99911
外卖平台佣金
99912
外卖平台活动优惠
99913口碑其他费用
99914
替用户承担配送费(新)
99921
餐位/茶位费
99922
消费服务费
99923
消费税金