# 佣金设置接口
| 接口名称 | 说明 |
|---|---|
| 设置佣金比例 | 支持联盟商家通过接口为组件过审商品设置佣金比例 |
| 查询佣金比例 | 支持联盟商家通过接口查询商品的佣金比例 |
| 删除佣金比例 | 支持联盟商家通过接口删除商品的佣金比例 |
# 1.设置佣金比例
# 接口说明
支持联盟商家通过接口为组件过审商品设置佣金
# 请求地址
POST https://api.weixin.qq.com/union/shop/open/set_commission?access_token=ACCESS_TOKEN
# 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| access_token | string | 是 | 接口调用凭证 | |
| info | Array.<object> | 是 | 商品对象信息 |
key 的结构
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| productId | number | 与outProductId二选一 | 商品ID |
| outProductId | string | 与productId二选一 | 商家自定义商品ID |
| commissionRatio | number | 是 | 佣金比例,保留两位小数,比如值为1000对应的佣金比例为10% |
# POST 数据示例
{
"info": [{
"productId": 411330134,
"outProductId": "1234566",
"commissionRatio": 1000
}]
}
# 返回值
| 属性 | 类型 | 说明 |
|---|---|---|
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
# 返回数据示例
{
"errcode": 0,
"errmsg": "商品id:411330134 未过审"
}
# 2.查询佣金比例
# 接口说明
支持联盟商家通过接口查询商品的佣金比例
# 请求地址
POST https://api.weixin.qq.com/union/shop/open/get_commission?access_token=ACCESS_TOKEN
# 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| access_token | string | 是 | 接口调用凭证 | |
| key | Array.<object> | 是 | 商品对象信息 |
key 的结构
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| productId | number | 与outProductId二选一 | 商品ID |
| outProductId | string | 与productId二选一 | 商家自定义商品ID |
# POST 数据示例
{
"key": [{
"productId": 411330134,
"outProductId": "1234566"
}]
}
# 返回值
| 属性 | 类型 | 说明 |
|---|---|---|
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
| result | Array.<Object> | 商品佣金详情 |
result 的结构
| 属性 | 类型 | 说明 |
|---|---|---|
| productId | string | 商品ID |
| outProductId | string | 商家自定义商品ID |
| isCommissionProduct | boolean | 是否佣金商品,1表示商品已设佣,0表示商品未设佣 |
| commissionRatio | number | 现行佣金比例,保留两位小数,比如值为1000对应的佣金比例为10% |
| nextCommissionRatio | number | 待生效佣金比例 |
| effectiveTime | number | 生效时间 |
# 返回数据示例
{
"errcode": 0,
"errmsg": "ok",
"result": [
{
"productId": "411330134",
"outProductId": "1234566",
"isCommissionProduct": false
}
]
}
# 3.删除佣金比例
# 接口说明
支持联盟商家通过接口删除商品的佣金比例
# 请求地址
POST https://api.weixin.qq.com/union/shop/open/delete_commission?access_token=ACCESS_TOKEN
# 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| access_token | string | 是 | 接口调用凭证 | |
| key | Array.<object> | 是 | 商品对象信息 |
key 的结构
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| productId | number | 与outProductId二选一 | 商品ID |
| outProductId | string | 与productId二选一 | 商家自定义商品ID |
# POST 数据示例
{
"key": [{
"productId": 411330134,
"outProductId": "1234566"
}]
}
# 返回值
| 属性 | 类型 | 说明 |
|---|---|---|
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
# 返回数据示例
{
"errcode": 0,
"errmsg": "ok"
}
# 错误码
| 值 | 说明 |
|---|---|
| 110000 | 传入商品数超出上限,单次上限为30个 |
| 110001 | 商品不存在 |
| 110002 | 系统异常 |
| 110004 | 参数错误 |
| 110005 | 商品未通过交易组件审核 |
| 110006 | 商品类目为联盟禁止推广类目,详情请参考《小程序联盟运营规范》中的“不开放推广的类目” |
| 110007 | 佣金比例需大于或等于基准类目佣金比例,详情请参考《基准佣金比例(非个人主体类型店)》 |
| 110009 | 商品未设置佣金,无法删除佣金比例 |