微信小程序 小程序使用·bindAccount

2022-05-11 15:10 更新

logistics.bindAccount

本接口应在服务器端调用,详细说明参见服务端API。
本接口支持云调用。需开发者工具版本 >= 1.02.1904090(最新稳定版下载)
wx-server-sdk >= 0.4.0

绑定、解绑物流账号

调用方式:

  • HTTPS 调用
  • 云调用

HTTPS 调用

请求地址

POST https://api.weixin.qq.com/cgi-bin/express/business/account/bind?access_token=ACCESS_TOKEN

请求参数

属性 类型 默认值 必填 说明
access_token string 是 接口调用凭证
type string 是 bind表示绑定,unbind表示解除绑定
biz_id string 是 快递公司客户编码
delivery_id string 是 快递公司ID
password string 否 快递公司客户密码, ems,顺丰,京东非必填
remark_content string 否 备注内容(提交EMS审核需要)

返回值

Object

属性 类型 说明
errcode number 错误码
errmsg string 错误信息

errcode 的合法值

值 说明 最低版本
0 成功
-1 系统失败
9300529 账号已绑定过
9300530 解绑的biz_id不存在
9300531 账号或密码错误
9300532 绑定已提交,审核中

请求数据示例

{
  "type": "bind",
  "biz_id": "123456",
  "delivery_id": "YUNDA",
  "password": "123456789123456789"
}

返回数据示例

{
  "errcode": 0,
  "errmsg": "ok"
}

云调用

云调用是小程序·云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 wx-server-sdk 使用。

接口方法

openapi.logistics.bindAccount
需在 config.json 中配置 logistics.bindAccount API 的权限,详情

请求参数

属性 类型 默认值 必填 说明
type string 是 bind表示绑定,unbind表示解除绑定
bizId string 是 快递公司客户编码
deliveryId string 是 快递公司ID
password string 否 快递公司客户密码, ems,顺丰,京东非必填
remarkContent string 否 备注内容(提交EMS审核需要)

返回值

Object

属性 类型 说明
errCode number 错误码
errMsg string 错误信息

errCode 的合法值

值 说明 最低版本
0 成功

异常

Object

抛出的异常

属性 类型 说明
errCode number 错误码
errMsg string 错误信息

errCode 的合法值

值 说明 最低版本
-1 系统失败
9300529 账号已绑定过
9300530 解绑的biz_id不存在
9300531 账号或密码错误
9300532 绑定已提交,审核中

请求数据示例

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.logistics.bindAccount({
        type: 'bind',
        password: '123456789123456789',
        bizId: '123456',
        deliveryId: 'YUNDA'
      })
    return result
  } catch (err) {
    return err
  }
}

返回数据示例

{
  "errCode": 0,
  "errMsg": "openapi.logistics.bindAccount:ok"
}


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号