查询零售小店活动业务代理

更新时间:2024.12.25

该接口为服务商或商户给零售小店活动查询业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。

# 接口说明

支持商户:
【普通服务商】
请求方式:
【GET】/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives
请求域名:
【主域名】
https://api.mch.weixin.qq.com
使用该域名将访问就近的接入点
【备域名】
https://api2.mch.weixin.qq.com
使用该域名将访问异地的接入点 ,指引点击查看

# 请求参数

    Header HTTP头参数
  • Authorization 必填 string
    请参考 签名认证 生成认证信息
  • Accept 必填 string
    请设置为 application/json
    Path 路径参数
  • activity_id 必填 string(128)
    【零售小店活动ID】 零售小店活动ID
    Query 查询参数
  • offset 必填 integer
    【分页页码】 页码从0开始,默认第0页
  • limit 必填 integer
    【分页大小】 分页大小,默认查询10个业代

请求示例

GET
1package com.wechat.pay.java.service.retailstore;
2import com.wechat.pay.java.core.Config;
3import com.wechat.pay.java.core.RSAAutoCertificateConfig;
4import com.wechat.pay.java.service.retailstore.model.ListRepresentativeRequest;
5import com.wechat.pay.java.service.retailstore.model.ListRepresentativeResponse;
6public class ListRepresentative { /** 商户号 */
7 public static String merchantId = "190000****"; /** 商户API私钥路径 */
8 public static String privateKeyPath =
9 "/Users/yourname/your/path/apiclient_key.pem"; /** 商户证书序列号 */
10 public static String merchantSerialNumber =
11 "5157F09EFDC096DE15EBE81A47057A72********"; /** 商户APIV3密钥 */
12 public static String apiV3Key = "...";
13 public static RetailStoreService service;
14 public static void main(String[] args) {
15 Config config = new RSAAutoCertificateConfig.Builder()
16 .merchantId(merchantId)
17 .privateKeyFromPath(privateKeyPath)
18 .merchantSerialNumber(merchantSerialNumber)
19 .apiV3Key(apiV3Key)
20 .build();
21 service = new RetailStoreService.Builder().config(config).build();
22 ListRepresentativeRequest request = new ListRepresentativeRequest();
23 request.setActivityId("3118550000000004");
24 request.setOffset(1L);
25 request.setLimit(1L);
26 ListRepresentativeResponse response = service.listRepresentative(request);
27 }
28}
1package main
2
3import (
4 "context"
5 "log"
6
7 "github.com/wechatpay-apiv3/wechatpay-go/core"
8 "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore"
9 "github.com/wechatpay-apiv3/wechatpay-go/utils"
10)
11
12func main() {
13 var (
14 mchID string = "190000****" // 商户号
15 mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
16 mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥
17 )
18
19 // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
20 mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
21 if err != nil {
22 log.Printf("load merchant private key error:%s", err)
23 return
24 }
25
26 ctx := context.Background()
27 // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
28 opts := []core.ClientOption{
29 option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
30 }
31 client, err := core.NewClient(ctx, opts...)
32 if err != nil {
33 log.Printf("new wechat pay client err:%s", err)
34 return
35 }
36
37 svc := retailstore.RetailStoreActApiService{Client: client}
38 resp, result, err := svc.ListRepresentative(ctx,
39 retailstore.ListRepresentativeRequest{
40 ActivityId: core.String("3118550000000004"),
41 Offset: core.Int64(0),
42 Limit: core.Int64(10),
43 },
44 )
45
46 if err != nil {
47 // 处理错误
48 log.Printf("call ListRepresentative err:%s", err)
49 } else {
50 // 处理返回结果
51 log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
52 }
53}
1curl -X GET \
2 https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/3118550000000004/representatives?offset=0&limit=10 \
3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \
4 -H "Accept: application/json"

# 应答参数

    200OK
  • total_count 选填 integer
    【小店活动业代总数】 小店活动业代总数
  • data 选填 array[object]
    【小店活动业代集合】 小店活动业代集合
    • 属性
  • offset 必填 integer
    【分页页码】 页码从0开始,默认第0页
  • limit 必填 integer
    【分页大小】 分页大小

应答示例

200 OK
1{
2 "total_count" : 1000,
3 "data" : [
4 {
5 "openid" : "oK7fFt8zzEZ909XH-LE2#"
6 }
7 ],
8 "offset" : 0,
9 "limit" : 10
10}

# 错误码

# 公共错误码

状态码 错误码 描述 解决方案
400 PARAM_ERROR 参数错误 请根据错误提示正确传入参数
400 INVALID_REQUEST HTTP 请求不符合微信支付 APIv3 接口规则 请参阅 接口规则
401 SIGN_ERROR 验证不通过 请参阅 签名常见问题
500 SYSTEM_ERROR 系统异常,请稍后重试 请稍后重试

# 业务错误码

状态码 错误码 描述 解决方案
400 INVALID_REQUEST 无效请求 请根据接口返回的详细信息检查
400 INVALID_REQUEST 参数错误 根据错误提示,传入正确参数
500 SYSTEM_ERROR 系统错误 请使用相同参数稍后重新调用
反馈
咨询
目录

微信支付文档中心已升级,你当前所查看的是旧文档中心的内容,旧文档中心将于 2025年 3 月 31日 下线,请移步 [新文档中心] 查看相应的内容