# 订单信息同步

# 简介

开发者可通过订单同步接口将订单信息同步到快手小程序订单中心,便于用户查找订单信息,并提供回访小程序的入口。

快手APP-侧边栏-小程序-订单中心入口 订单中心-全部 订单中心-退款/售后
img img img

# 一、接口定义

# 1、订单同步接口

接口说明 第三方应用进行订单同步(目前仅支持单商品)
权限说明 需要小程序有担保支付权限(scope.ks.epay)
path https://open.kuaishou.com (opens new window)/openapi/mp/developer/order/v1/report
Method POST

Request Param

字段 类型 含义 示例
app_id string request param
access_token string request param

以下参数作为body发送

{
    "out_order_no": "8763",
    "out_biz_order_no": "4555",
    "open_id" : "",
    "order_create_time" : 123333333333,  //ms
    "order_status" : 1,
    "order_path" : "/pages/home",
    "order_backup_url" : "https//www.baidu.com",
    "product_cover_img_id" : "5acfa5c094cb7944fc4adf6359a937952b5a38da17a8",
    "poi_id" : "6724909328451368582",
    "product_id" : "ks10398",
    "product_catalog_code": 10107,
    "product_city":"北京市海淀区"
}

body参数说明

参数名 类型 是否必填 备注
out_biz_order_no 字符串[6,32] 展示在用户端的唯一订单号。商户订单系统订单号,只能是6-32位的数字、大小写字母或_-*
out_order_no 字符串[6,32] 小程序预下单支付订单号(同支付预下单的out_order_no。如果支付单号与订单号相同,则传相同单号即可。)
open_id 字符串 订单对应的用户open id
order_create_time 数字 订单创建时间,需小于等于当前时间 单位:ms
order_status 数字 订单状态(订单状态的值见下表)
order_path 字符串 订单path,用于跳转到小程序内订单详情页,需要存在于小程序最新版本的包中
order_backup_url 字符串 订单备用h5链接,需要是http/https协议
product_cover_img_id 字符串 商品图对应的imgId(通过文件上传接口获取),要求长宽比1:1,最大不超过10MB。需与用户下单时的商品图保持一致
poi_id 字符串 若商品已经与快手的商品库对接,并且可确定poiId,则可传poiId
product_id 字符串 否(本地生活类必填) 商品id,需与商品库对接时的商品id保持一致。
product_catalog_code 数字 否(本地生活类必填) 商品类目代码,具体见商品类目附录
product_city 字符串(0,15] 否(本地生活类必填) 商品所在城市的完整名称。直辖市支持格式示例(最长:市+区):北京市昌平区、北京市、昌平区; 非直辖市支持格式示例(最长:省+市+区):河北省石家庄市裕华区、石家庄市裕华区、石家庄市、裕华区。市

订单号说明

如果用户提交订单后发起多次支付,小程序均使用唯一订单号发起支付,即订单系统与支付系统未拆分,则out_biz_order_no与out_order_no传相同值,均为用户端展示的唯一订单号;

如果用户提交订单后发起多次支付,小程序会基于订单生成多个支付单,即订单系统与支付系统拆分,则out_biz_order_no传用户侧展示的唯一订单号,out_order_no传支付预下单号;

订单状态

含义 备注
1 待支付 支付状态
2 支付成功 支付状态
3 已取消 支付状态
4 退款中 退款状态
5 退款失败 退款状态
6 退款成功 退款状态,含使用后退款
10 待使用 虚拟类商品状态,含团购券待核销等状态
11 已使用 虚拟类商品状态,含团购券已核销等状态
12 待发货 实物类商品状态
13 部分发货 实物类商品状态
14 待收货 实物类商品状态
15 交易成功 实物类商品状态。用户��认收货,交易完成。

不同类型的商品订单状态说明

商品类型订单状态说明
虚拟类商品(含团购券等)1、2、3、4、5、6、7、8、9、10、11 (1-11)
实物商品1、2、3、4、5、6、12、13、14、15
部分订单状态可根据实际情况,确定是否回传,如:一个订单购买多个商品,部分发货可视为待发货。

请求示例

curl --location --request POST 'https://open.kuaishou.com/openapi/mp/developer/order/v1/report
?app_id=ks707065143182458884&access_token=ChFvYXV0aC5hY2Nlc3NUb2tlbhJQcXi6SorFfkg786OWTtGyvXf1Qz0wbN2pt4YlWHppV78IzJA92mwdcdRqegxMFRwBRTM6r5vVYzMFUlbqAfPpdYYKpRlywCtyzomu7d_mt44aEqr20o3-d0Tt4_ZJzk9p2G6vnyIg4o35UNBVgOdoJEObJmLLnr4IiN6SZO3G2saTmDnPtLEoDzAB' \
--header 'Content-Type: application/json' \
--data '{
    "out_order_no": "8763",
    "out_biz_order_no": "4555",
    "open_id" : "",
    "order_create_time" : 123333333333,  //ms
    "order_status" : 1,
    "order_path" : "/pages/home",
    "order_backup_url" : "https//www.baidu.com",
    "product_cover_img_id" : "5acfa5c094cb7944fc4adf6359a937952b5a38da17a8",
    "poi_id" : "6724909328451368582",
    "product_id" : "ks10398",
    "product_catalog_code": 10107,
    "product_city":"北京市海淀区"
}'

Response

正常返回

{
    "result": 1,
    "error_msg": "success"
}

# 2、通过文件进行图片上传

接口说明 通过文件进行图片上传
path https://open.kuaishou.com (opens new window)/openapi/mp/developer/file//img/uploadWithFile
Method POST

Request Param

字段 类型 含义 是否必传
app_id string request param
access_token string request paaram

以下参数作为body发送,Content-Type使用multipart/form-data

body参数说明

参数名 类型 是否必填 备注
file file 图片文件,允许的图片后缀:png jpg jpeg

Response

正常返回

{
    "result": 1,
    "error_msg": "success",
      "data" : {
          "imgId" : "ssssss"
    }
}

# 3、通过url进行图片上传

接口说明 通过url进行图片上传
path https://open.kuaishou.com (opens new window)/openapi/mp/developer/file//img/uploadWithUrl
Method POST

Request Param

字段 类型 含义 是否必传
app_id string request param
access_token string request paaram
url string request paaram

Response

正常返回

{
    "result": 1,
    "error_msg": "success",
      "data" : {
          "imgId" : "ssssss"
    }
}

# 二、错误码说明

错误码 描述
100200102 授权错误,请检查app_id和access_token是否正确
10000200 非法参数,请参考错误提示检查必填参数是否遗漏或参数格式是否正确
10000303 图片被风控拦截
10000305 被限流
10000417 上传的图片不存在
10002003 非法的poiId
10000419 非法的url
10000423 非法的open id
10001007 非法的path
10002018 订单未找到
10000500 系统异常
Copyright ©2024, All Rights Reserved