抖音开放平台Logo
开发者文档
“/”唤起搜索
控制台
  • JS API 列表
  • 基础
  • TTML
  • 网络
  • 媒体
  • 地图
  • 文件
  • 数据缓存
  • 地理位置
  • 设备
  • 画布
  • 界面
  • 页面导航
  • 开放接口
  • 登录
  • 用户信息
  • 广告
  • 支付
  • 分享
  • 小程序跳转
  • 抖音视频能力
  • 收货地址
  • 设置
  • 授权
  • 评价能力
  • 数据分析
  • 视频拍摄器
  • 引导关注
  • 订阅消息
  • 电商插件能力(即将废弃)
  • 会员运营
  • 权益核销
  • 流量引导
  • 导购成交
  • 商品和订单查询
  • C2B 定制
  • (即将废弃)tt.submitEcCustomGoods
  • (即将废弃)tt.openEcCart
  • (即将废弃)tt.openEcOrder
  • (即将废弃)tt.getShopRecordToken
  • (即将废弃)tt.updateShopMemberPoints
  • 流量来源识别
  • 隐私信息授权
  • web化
  • 转发和挂载
  • 侧边栏能力
  • 直播能力
  • AI/AR能力
  • 安全能力
  • 行业开放
  • 第三方平台
  • 其它
  • 生活服务(即将废弃)
  • 注意
    本文档即将废弃,新文档请参见 plugin.submitEcCustomGoods
    基础库 2.74.0.0 开始支持本接口,使用时可用 tt.canIUse 判断是否可用。
    抖店支付成功订单以跳转小程序的方式定制商品,为小程序提供定制数据提交的能力,仅支持抖音 App 和抖音极速版 App。
    在使用行业相关的组件和 API 前,需要在代码中配置行业 SDK 的权限:行业 SDK 的权限配置,行业 SDK 的权限配置在基础库 2.74.0.0 抖音版本 23.0 以上支持。
    开发者需先按照 电商定制 文档完成前后端的定制能力接入。

    语法

    tt.submitEcCustomGoods({ orderId: "xxxx", filePath: "ttfile://abc", customData: { text: [ { id: 1, key: "手镯颜色", content: "黑色", }, ], extra: {}, }, success(res) { console.log("submitEcCustomGoods success", res); }, fail(res) { console.log("submitEcCustomGoods fail", res); }, complete(res) { console.log("submitEcCustomGoods complete", res); }, });

    参数说明

    属性名
    类型
    默认值
    必填
    说明
    最低支持版本
    orderId
    string
    --
    抖音订单 ID,可由用户主动填写,如果小程序页面 query 中存在 order_id 时会取 order_id,无需传此属性,当小程序 query 的 order_id 为空时,可以传入该属性代替
    2.52.0.0
    filePath
    string
    --
    定制效果快照的本地文件地址,来源如下:
      可调用 tt.chooseImage 取返回的 tempFilePaths 作为入参传入;
      可调用 tt.downloadFile 取返回的 tempFilePath 作为入参传入;
    要求如下:
      文件协议为:“ttfile://”;
      目前只支持 jpg 格式文件;
      比例为 1:1,格式为 jpg,大小为 200KB 以内;
    2.52.0.0
    customData
    object
    --
    用户定制信息
    2.52.0.0
    success
    function
    --
    接口调用成功的回调函数
    2.52.0.0
    fail
    function
    --
    接口调用失败的回调函数
    2.52.0.0
    complete
    function
    --
    接口调用结束的回调函数(调用成功、失败都会执行)
    2.52.0.0
    customData 为 object 类型,属性如下:
    属性名
    类型
    默认值
    必填
    说明
    最低支持版本
    image
    Array<Object>
    []
    商家定制的图片信息,可传入开发者域名下的定制图片素材链接(本期暂不支持,暂不通过 抖店订单详情开放接口 透出
    2.52.0.0
    text
    Array<Object>
    --
    商家定制的文案信息
    2.52.0.0
    extra
    Object
    --
    其它扩展信息
    2.52.0.0
    customData.image 为 object 类型,属性如下:
    属性名
    类型
    默认值
    必填
    说明
    最低支持版本
    id
    number
    --
    自定义图片模块 ID
    2.52.0.0
    url
    string
    --
    定制图片链接,要求 https 协议
    2.52.0.0
    customData.text 为 object 类型,属性如下:
    属性名
    类型
    默认值
    必填
    说明
    最低支持版本
    id
    number
    --
    自定义文案模块 ID
    2.52.0.0
    key
    string
    --
    标记可定制的内容,如商品名称和规格名称
    2.52.0.0
    content
    string
    --
    标记用户定制的具体信息,如定制数量和定制要求
    2.52.0.0

    回调成功

    参数为 Object 类型,属性如下:
    参数
    参数类型
    说明
    最低支持版本
    errMsg
    string
    回调信息
    2.52.0.0

    回调失败

    参数为 Object 类型,属性如下:
    参数
    参数类型
    说明
    最低支持版本
    errNo
    number
    错误码
    2.52.0.0
    errMsg
    string
    错误信息
    2.52.0.0
    错误码说明:
    errNo
    errMsg
    说明
    10101
    Platform auth deny
    权限错误,不在白名单内;
    10301
    The feature is only support in Douyin and DonyinLite
    仅支持在抖音、抖音极速版中使用,当前 App 不支持这个功能
    20000
    xxx should be string, but got xxx
    参数类型校验错误,请检查参数类型
    21500
    Invalid login status, please check login status
    获取宿主登录信息失败,用户未登录
    21501
    Network error
    网络错误,请检查网络状况
    21502
    Server error
    服务端网关错误(如 404、502 等),请联系客服助手
    21503
    Value of orderId cannot be empty
    订单 ID 为空
    21655
    定制信息填入失败,稍后重试
    内部服务不稳定,可以联系客服助手
    21660
    当前订单状态不支持定制
    不支持重复上传定制信息,或者订单流程已经结束
    21661
    定会信息提交不全
    后续如果存在一笔订单,多个定制商品,则需要同时上报。第一期暂时不会出现
    21662
    定制订单中含有不同店铺的信息
    后续如果存在一笔订单,多个定制商品,则需要都是同个店铺的商品。第一期暂时不会出现

    定制成功回调开发者接口

    请求类型:POST。
    请求头:
    参数名
    参数类型
    是否必须
    说明
    Content-Type
    string
    请求的 MIME 类型,统一固定为 application/json
    请求参数:
    参数
    参数类型
    是否必传
    说明
    order_ids
    list
    校验成功的订单(目前 list 中只有一条数据)
    开发者响应参数(目前并不关注开发者的处理结果,只关注是否通知到):
    参数
    参数类型
    是否必传
    说明
    err_no
    number
    响应结果
    err_msg
    string
    响应结果数据

    代码示例

    canvas 方案:
    <!-- ttml --> <view> <canvas canvas-id="myCanvas" /> <button type="default" size="default" bindtap="submit"> 提交定制信息 </button> </view>
    // js Page({ submit() { const self = this; tt.login(); tt.showLoading({ title: "正在提交", }); tt.canvasToTempFilePath({ canvasId: "myCanvas", success(res) { self.submitEcCustomGoods(res.tempFilePath); }, }); }, submitEcCustomGoods(path) { tt.submitEcCustomGoods({ orderId: "xx_order_id", filePath: path, customData: { text: [ { id: 1, key: "手镯颜色", content: "黑色", }, ], extra: {}, }, success(res) { console.log("tt.submitEcCustomGoods success", res); }, fail(res) { console.log("tt.submitEcCustomGoods fail", res); }, complete(res) { console.log("tt.submitEcCustomGoods complete", res); tt.hideLoading(); }, }); }, });
    image 方案:
    <!-- ttml --> <view> <button type="default" size="default" bindtap="submit"> 提交定制信息 </button> </view>
    // js Page({ submit() { tt.login(); tt.showLoading({ title: "正在提交", }); tt.downloadFile({ url: "https://你的图片地址", header: { "content-type": "application/json", }, success(res) { console.log("downloadFile success", res); this.submitEcCustomGoods(res.tempFilePath); }, fail(res) { console.log("downloadFile fail", res); }, complete: (res) => { console.log("downloadFile complete", res); }, }); }, submitEcCustomGoods(path) { tt.submitEcCustomGoods({ orderId: "xx_order_id", filePath: path, customData: { text: [ { id: 1, key: "手镯颜色", content: "黑色", }, ], extra: {}, }, success(res) { console.log("tt.submitEcCustomGoods success", res); }, fail(res) { console.log("tt.submitEcCustomGoods fail", res); }, complete(res) { console.log("tt.submitEcCustomGoods complete", res); tt.hideLoading(); }, }); }, });