获取支付有礼活动列表
更新时间:2024.11.18使用场景:商户根据一定过滤条件,查询已创建的支付有礼活动。
可调用商户:商户/服务商/渠道商
接口说明
支持商户:【普通服务商】
请求方式:【GET】/v3/marketing/paygiftactivity/activities
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
query 查询参数
offset 必填 integer
【分页页码】分页页码
limit 必填 integer
【分页大小】分页大小
activity_name 选填 string(10)
【活动名称】活动名称,支持模糊搜索
activity_status 选填 string
【活动状态】活动状态
可选取值:
ACT_STATUS_UNKNOWN
: 状态未知
CREATE_ACT_STATUS
: 已创建
ONGOING_ACT_STATUS
: 运行中
TERMINATE_ACT_STATUS
: 已终止
STOP_ACT_STATUS
: 已暂停
OVER_TIME_ACT_STATUS
: 已过期
CREATE_ACT_FAILED
: 创建活动失败
award_type 选填 string
【奖品类型】奖品类型,暂时只支持商家券
可选取值:
BUSIFAVOR
: 商家券
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities?offset=1&limit=20&activity_name=良品铺子回馈活动&activity_status=ACT_STATUS_UNKNOWN&award_type=BUSIFAVOR \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" 5
需配合微信支付工具库 WXPayUtility 使用,请参考Java
1package com.java.demo; 2 3import com.java.utils.WXPayUtility; // 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/v3/partner/4014985777 4 5import com.google.gson.annotations.SerializedName; 6import com.google.gson.annotations.Expose; 7import okhttp3.MediaType; 8import okhttp3.OkHttpClient; 9import okhttp3.Request; 10import okhttp3.RequestBody; 11import okhttp3.Response; 12 13import java.io.IOException; 14import java.io.UncheckedIOException; 15import java.security.PrivateKey; 16import java.security.PublicKey; 17import java.util.ArrayList; 18import java.util.HashMap; 19import java.util.List; 20import java.util.Map; 21 22/** 23 * 获取支付有礼活动列表 24 */ 25public class ListActivities { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/v3/marketing/paygiftactivity/activities"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 ListActivities client = new ListActivities( 33 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 34 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 35 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 36 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 37 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 38 ); 39 40 ListActivitiesRequest request = new ListActivitiesRequest(); 41 request.offset = 1L; 42 request.limit = 1L; 43 request.activityName = "良品铺子回馈活动"; 44 request.activityStatus = ActStatus.ACT_STATUS_UNKNOWN; 45 request.awardType = AwardType.BUSIFAVOR; 46 try { 47 ListActivitiesResponse response = client.run(request); 48 // TODO: 请求成功,继续业务逻辑 49 System.out.println(response); 50 } catch (WXPayUtility.ApiException e) { 51 // TODO: 请求失败,根据状态码执行不同的逻辑 52 e.printStackTrace(); 53 } 54 } 55 56 public ListActivitiesResponse run(ListActivitiesRequest request) { 57 String uri = PATH; 58 Map<String, Object> args = new HashMap<>(); 59 args.put("offset", request.offset); 60 args.put("limit", request.limit); 61 args.put("activity_name", request.activityName); 62 args.put("activity_status", request.activityStatus); 63 args.put("award_type", request.awardType); 64 String queryString = WXPayUtility.urlEncode(args); 65 if (!queryString.isEmpty()) { 66 uri = uri + "?" + queryString; 67 } 68 69 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 70 reqBuilder.addHeader("Accept", "application/json"); 71 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 72 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 73 reqBuilder.method(METHOD, null); 74 Request httpRequest = reqBuilder.build(); 75 76 // 发送HTTP请求 77 OkHttpClient client = new OkHttpClient.Builder().build(); 78 try (Response httpResponse = client.newCall(httpRequest).execute()) { 79 String respBody = WXPayUtility.extractBody(httpResponse); 80 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 81 // 2XX 成功,验证应答签名 82 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 83 httpResponse.headers(), respBody); 84 85 // 从HTTP应答报文构建返回数据 86 return WXPayUtility.fromJson(respBody, ListActivitiesResponse.class); 87 } else { 88 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 89 } 90 } catch (IOException e) { 91 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 92 } 93 } 94 95 private final String mchid; 96 private final String certificateSerialNo; 97 private final PrivateKey privateKey; 98 private final String wechatPayPublicKeyId; 99 private final PublicKey wechatPayPublicKey; 100 101 public ListActivities(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 102 this.mchid = mchid; 103 this.certificateSerialNo = certificateSerialNo; 104 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 105 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 106 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 107 } 108 109 public static class ListActivitiesRequest { 110 @SerializedName("offset") 111 @Expose(serialize = false) 112 public Long offset; 113 114 @SerializedName("limit") 115 @Expose(serialize = false) 116 public Long limit; 117 118 @SerializedName("activity_name") 119 @Expose(serialize = false) 120 public String activityName; 121 122 @SerializedName("activity_status") 123 @Expose(serialize = false) 124 public ActStatus activityStatus; 125 126 @SerializedName("award_type") 127 @Expose(serialize = false) 128 public AwardType awardType; 129 } 130 131 public static class ListActivitiesResponse { 132 @SerializedName("data") 133 public List<ActivityInformation> data; 134 135 @SerializedName("total_count") 136 public Long totalCount; 137 138 @SerializedName("offset") 139 public Long offset; 140 141 @SerializedName("limit") 142 public Long limit; 143 } 144 145 public enum ActStatus { 146 @SerializedName("ACT_STATUS_UNKNOWN") 147 ACT_STATUS_UNKNOWN, 148 @SerializedName("CREATE_ACT_STATUS") 149 CREATE_ACT_STATUS, 150 @SerializedName("ONGOING_ACT_STATUS") 151 ONGOING_ACT_STATUS, 152 @SerializedName("TERMINATE_ACT_STATUS") 153 TERMINATE_ACT_STATUS, 154 @SerializedName("STOP_ACT_STATUS") 155 STOP_ACT_STATUS, 156 @SerializedName("OVER_TIME_ACT_STATUS") 157 OVER_TIME_ACT_STATUS, 158 @SerializedName("CREATE_ACT_FAILED") 159 CREATE_ACT_FAILED 160 } 161 162 public enum AwardType { 163 @SerializedName("BUSIFAVOR") 164 BUSIFAVOR 165 } 166 167 public static class ActivityInformation { 168 @SerializedName("activity_id") 169 public String activityId; 170 171 @SerializedName("activity_type") 172 public ActType activityType; 173 174 @SerializedName("activity_base_info") 175 public ActBaseInfo activityBaseInfo; 176 177 @SerializedName("award_send_rule") 178 public AwardSendRule awardSendRule; 179 180 @SerializedName("advanced_setting") 181 public ActAdvancedSetting advancedSetting; 182 183 @SerializedName("activity_status") 184 public ActStatus activityStatus; 185 186 @SerializedName("creator_merchant_id") 187 public String creatorMerchantId; 188 189 @SerializedName("belong_merchant_id") 190 public String belongMerchantId; 191 192 @SerializedName("create_time") 193 public String createTime; 194 195 @SerializedName("update_time") 196 public String updateTime; 197 } 198 199 public enum ActType { 200 @SerializedName("FULL_SEND_ACT_TYPE") 201 FULL_SEND_ACT_TYPE, 202 @SerializedName("STEP_SEND_ACT_TYPE") 203 STEP_SEND_ACT_TYPE, 204 @SerializedName("SPECIFIC_SEND_ACT_TYPE") 205 SPECIFIC_SEND_ACT_TYPE 206 } 207 208 public static class ActBaseInfo { 209 @SerializedName("activity_name") 210 public String activityName; 211 212 @SerializedName("activity_second_title") 213 public String activitySecondTitle; 214 215 @SerializedName("merchant_logo_url") 216 public String merchantLogoUrl; 217 218 @SerializedName("background_color") 219 public String backgroundColor; 220 221 @SerializedName("begin_time") 222 public String beginTime; 223 224 @SerializedName("end_time") 225 public String endTime; 226 227 @SerializedName("available_periods") 228 public AvailablePeriod availablePeriods; 229 230 @SerializedName("out_request_no") 231 public String outRequestNo; 232 233 @SerializedName("delivery_purpose") 234 public DeliveryPurposeCategory deliveryPurpose; 235 236 @SerializedName("mini_programs_appid") 237 public String miniProgramsAppid; 238 239 @SerializedName("mini_programs_path") 240 public String miniProgramsPath; 241 } 242 243 public static class AwardSendRule { 244 @SerializedName("full_send_rule") 245 public FullSendRule fullSendRule; 246 } 247 248 public static class ActAdvancedSetting { 249 @SerializedName("delivery_user_category") 250 public DeliveryUserCategory deliveryUserCategory; 251 252 @SerializedName("merchant_member_appid") 253 public String merchantMemberAppid; 254 255 @SerializedName("payment_mode") 256 public PaymentMode paymentMode; 257 258 @SerializedName("payment_method_information") 259 public PaymentMethodInfo paymentMethodInformation; 260 261 @SerializedName("goods_tags") 262 public List<String> goodsTags; 263 } 264 265 public static class AvailablePeriod { 266 @SerializedName("available_time") 267 public List<AvailableTime> availableTime; 268 269 @SerializedName("available_day_time") 270 public List<AvailableDayTime> availableDayTime; 271 } 272 273 public enum DeliveryPurposeCategory { 274 @SerializedName("OFF_LINE_PAY") 275 OFF_LINE_PAY, 276 @SerializedName("JUMP_MINI_APP") 277 JUMP_MINI_APP 278 } 279 280 public static class FullSendRule { 281 @SerializedName("transaction_amount_minimum") 282 public Long transactionAmountMinimum; 283 284 @SerializedName("send_content") 285 public SendContentCategory sendContent; 286 287 @SerializedName("award_type") 288 public AwardType awardType; 289 290 @SerializedName("award_list") 291 public List<AwardBaseInfo> awardList = new ArrayList<AwardBaseInfo>(); 292 293 @SerializedName("merchant_option") 294 public SendMerchantOption merchantOption; 295 296 @SerializedName("merchant_id_list") 297 public List<String> merchantIdList; 298 } 299 300 public enum DeliveryUserCategory { 301 @SerializedName("DELIVERY_ALL_PERSON") 302 DELIVERY_ALL_PERSON, 303 @SerializedName("DELIVERY_MEMBER_PERSON") 304 DELIVERY_MEMBER_PERSON 305 } 306 307 public static class PaymentMode { 308 @SerializedName("payment_scene_list") 309 public List<PaymentScene> paymentSceneList; 310 } 311 312 public static class PaymentMethodInfo { 313 @SerializedName("payment_method") 314 public PaymentMethodCategory paymentMethod; 315 316 @SerializedName("bank_abbreviation") 317 public String bankAbbreviation; 318 } 319 320 public static class AvailableTime { 321 @SerializedName("begin_time") 322 public String beginTime; 323 324 @SerializedName("end_time") 325 public String endTime; 326 } 327 328 public static class AvailableDayTime { 329 @SerializedName("begin_day_time") 330 public String beginDayTime; 331 332 @SerializedName("end_day_time") 333 public String endDayTime; 334 } 335 336 public enum SendContentCategory { 337 @SerializedName("SINGLE_COUPON") 338 SINGLE_COUPON, 339 @SerializedName("GIFT_PACKAGE") 340 GIFT_PACKAGE 341 } 342 343 public static class AwardBaseInfo { 344 @SerializedName("stock_id") 345 public String stockId; 346 347 @SerializedName("original_image_url") 348 public String originalImageUrl; 349 350 @SerializedName("thumbnail_url") 351 public String thumbnailUrl; 352 } 353 354 public enum SendMerchantOption { 355 @SerializedName("IN_SEVICE_COUPON_MERCHANT") 356 IN_SEVICE_COUPON_MERCHANT, 357 @SerializedName("MANUAL_INPUT_MERCHANT") 358 MANUAL_INPUT_MERCHANT 359 } 360 361 public enum PaymentScene { 362 @SerializedName("APP_SCENE") 363 APP_SCENE, 364 @SerializedName("SWING_CARD_SCENE") 365 SWING_CARD_SCENE, 366 @SerializedName("NO_SECRET_SCENE") 367 NO_SECRET_SCENE, 368 @SerializedName("MINIAPP_SCENE") 369 MINIAPP_SCENE, 370 @SerializedName("FACE_PAY_SCENE") 371 FACE_PAY_SCENE, 372 @SerializedName("OTHER_SCENE") 373 OTHER_SCENE 374 } 375 376 public enum PaymentMethodCategory { 377 @SerializedName("CFT") 378 CFT, 379 @SerializedName("SPECIFIC_BANK_CARD") 380 SPECIFIC_BANK_CARD 381 } 382 383} 384
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/partner/4015119446 5 "encoding/json" 6 "fmt" 7 "net/http" 8 "net/url" 9) 10 11func main() { 12 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 13 config, err := wxpay_utility.CreateMchConfig( 14 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 15 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 16 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 17 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 18 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 19 ) 20 if err != nil { 21 fmt.Println(err) 22 return 23 } 24 25 request := &ListActivitiesRequest{ 26 Offset: wxpay_utility.Int64(1), 27 Limit: wxpay_utility.Int64(20), 28 ActivityName: wxpay_utility.String("良品铺子回馈活动"), 29 ActivityStatus: ACTSTATUS_ACT_STATUS_UNKNOWN.Ptr(), 30 AwardType: AWARDTYPE_BUSIFAVOR.Ptr(), 31 } 32 33 response, err := ListActivities(config, request) 34 if err != nil { 35 fmt.Printf("请求失败: %+v\n", err) 36 // TODO: 请求失败,根据状态码执行不同的处理 37 return 38 } 39 40 // TODO: 请求成功,继续业务逻辑 41 fmt.Printf("请求成功: %+v\n", response) 42} 43 44func ListActivities(config *wxpay_utility.MchConfig, request *ListActivitiesRequest) (response *ListActivitiesResponse, err error) { 45 const ( 46 host = "https://api.mch.weixin.qq.com" 47 method = "GET" 48 path = "/v3/marketing/paygiftactivity/activities" 49 ) 50 51 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 52 if err != nil { 53 return nil, err 54 } 55 query := reqUrl.Query() 56 if request.Offset != nil { 57 query.Add("offset", fmt.Sprintf("%v", *request.Offset)) 58 } 59 if request.Limit != nil { 60 query.Add("limit", fmt.Sprintf("%v", *request.Limit)) 61 } 62 if request.ActivityName != nil { 63 query.Add("activity_name", *request.ActivityName) 64 } 65 if request.ActivityStatus != nil { 66 query.Add("activity_status", fmt.Sprintf("%v", *request.ActivityStatus)) 67 } 68 if request.AwardType != nil { 69 query.Add("award_type", fmt.Sprintf("%v", *request.AwardType)) 70 } 71 reqUrl.RawQuery = query.Encode() 72 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 73 if err != nil { 74 return nil, err 75 } 76 httpRequest.Header.Set("Accept", "application/json") 77 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 78 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 79 if err != nil { 80 return nil, err 81 } 82 httpRequest.Header.Set("Authorization", authorization) 83 84 client := &http.Client{} 85 httpResponse, err := client.Do(httpRequest) 86 if err != nil { 87 return nil, err 88 } 89 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 90 if err != nil { 91 return nil, err 92 } 93 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 94 // 2XX 成功,验证应答签名 95 err = wxpay_utility.ValidateResponse( 96 config.WechatPayPublicKeyId(), 97 config.WechatPayPublicKey(), 98 &httpResponse.Header, 99 respBody, 100 ) 101 if err != nil { 102 return nil, err 103 } 104 response := &ListActivitiesResponse{} 105 if err := json.Unmarshal(respBody, response); err != nil { 106 return nil, err 107 } 108 109 return response, nil 110 } else { 111 return nil, wxpay_utility.NewApiException( 112 httpResponse.StatusCode, 113 httpResponse.Header, 114 respBody, 115 ) 116 } 117} 118 119type ListActivitiesRequest struct { 120 Offset *int64 `json:"offset,omitempty"` 121 Limit *int64 `json:"limit,omitempty"` 122 ActivityName *string `json:"activity_name,omitempty"` 123 ActivityStatus *ActStatus `json:"activity_status,omitempty"` 124 AwardType *AwardType `json:"award_type,omitempty"` 125} 126 127func (o *ListActivitiesRequest) MarshalJSON() ([]byte, error) { 128 type Alias ListActivitiesRequest 129 a := &struct { 130 Offset *int64 `json:"offset,omitempty"` 131 Limit *int64 `json:"limit,omitempty"` 132 ActivityName *string `json:"activity_name,omitempty"` 133 ActivityStatus *ActStatus `json:"activity_status,omitempty"` 134 AwardType *AwardType `json:"award_type,omitempty"` 135 *Alias 136 }{ 137 // 序列化时移除非 Body 字段 138 Offset: nil, 139 Limit: nil, 140 ActivityName: nil, 141 ActivityStatus: nil, 142 AwardType: nil, 143 Alias: (*Alias)(o), 144 } 145 return json.Marshal(a) 146} 147 148type ListActivitiesResponse struct { 149 Data []ActivityInformation `json:"data,omitempty"` 150 TotalCount *int64 `json:"total_count,omitempty"` 151 Offset *int64 `json:"offset,omitempty"` 152 Limit *int64 `json:"limit,omitempty"` 153} 154 155type ActStatus string 156 157func (e ActStatus) Ptr() *ActStatus { 158 return &e 159} 160 161const ( 162 ACTSTATUS_ACT_STATUS_UNKNOWN ActStatus = "ACT_STATUS_UNKNOWN" 163 ACTSTATUS_CREATE_ACT_STATUS ActStatus = "CREATE_ACT_STATUS" 164 ACTSTATUS_ONGOING_ACT_STATUS ActStatus = "ONGOING_ACT_STATUS" 165 ACTSTATUS_TERMINATE_ACT_STATUS ActStatus = "TERMINATE_ACT_STATUS" 166 ACTSTATUS_STOP_ACT_STATUS ActStatus = "STOP_ACT_STATUS" 167 ACTSTATUS_OVER_TIME_ACT_STATUS ActStatus = "OVER_TIME_ACT_STATUS" 168 ACTSTATUS_CREATE_ACT_FAILED ActStatus = "CREATE_ACT_FAILED" 169) 170 171type AwardType string 172 173func (e AwardType) Ptr() *AwardType { 174 return &e 175} 176 177const ( 178 AWARDTYPE_BUSIFAVOR AwardType = "BUSIFAVOR" 179) 180 181type ActivityInformation struct { 182 ActivityId *string `json:"activity_id,omitempty"` 183 ActivityType *ActType `json:"activity_type,omitempty"` 184 ActivityBaseInfo *ActBaseInfo `json:"activity_base_info,omitempty"` 185 AwardSendRule *AwardSendRule `json:"award_send_rule,omitempty"` 186 AdvancedSetting *ActAdvancedSetting `json:"advanced_setting,omitempty"` 187 ActivityStatus *ActStatus `json:"activity_status,omitempty"` 188 CreatorMerchantId *string `json:"creator_merchant_id,omitempty"` 189 BelongMerchantId *string `json:"belong_merchant_id,omitempty"` 190 CreateTime *string `json:"create_time,omitempty"` 191 UpdateTime *string `json:"update_time,omitempty"` 192} 193 194type ActType string 195 196func (e ActType) Ptr() *ActType { 197 return &e 198} 199 200const ( 201 ACTTYPE_FULL_SEND_ACT_TYPE ActType = "FULL_SEND_ACT_TYPE" 202 ACTTYPE_STEP_SEND_ACT_TYPE ActType = "STEP_SEND_ACT_TYPE" 203 ACTTYPE_SPECIFIC_SEND_ACT_TYPE ActType = "SPECIFIC_SEND_ACT_TYPE" 204) 205 206type ActBaseInfo struct { 207 ActivityName *string `json:"activity_name,omitempty"` 208 ActivitySecondTitle *string `json:"activity_second_title,omitempty"` 209 MerchantLogoUrl *string `json:"merchant_logo_url,omitempty"` 210 BackgroundColor *string `json:"background_color,omitempty"` 211 BeginTime *string `json:"begin_time,omitempty"` 212 EndTime *string `json:"end_time,omitempty"` 213 AvailablePeriods *AvailablePeriod `json:"available_periods,omitempty"` 214 OutRequestNo *string `json:"out_request_no,omitempty"` 215 DeliveryPurpose *DeliveryPurposeCategory `json:"delivery_purpose,omitempty"` 216 MiniProgramsAppid *string `json:"mini_programs_appid,omitempty"` 217 MiniProgramsPath *string `json:"mini_programs_path,omitempty"` 218} 219 220type AwardSendRule struct { 221 FullSendRule *FullSendRule `json:"full_send_rule,omitempty"` 222} 223 224type ActAdvancedSetting struct { 225 DeliveryUserCategory *DeliveryUserCategory `json:"delivery_user_category,omitempty"` 226 MerchantMemberAppid *string `json:"merchant_member_appid,omitempty"` 227 PaymentMode *PaymentMode `json:"payment_mode,omitempty"` 228 PaymentMethodInformation *PaymentMethodInfo `json:"payment_method_information,omitempty"` 229 GoodsTags []string `json:"goods_tags,omitempty"` 230} 231 232type AvailablePeriod struct { 233 AvailableTime []AvailableTime `json:"available_time,omitempty"` 234 AvailableDayTime []AvailableDayTime `json:"available_day_time,omitempty"` 235} 236 237type DeliveryPurposeCategory string 238 239func (e DeliveryPurposeCategory) Ptr() *DeliveryPurposeCategory { 240 return &e 241} 242 243const ( 244 DELIVERYPURPOSECATEGORY_OFF_LINE_PAY DeliveryPurposeCategory = "OFF_LINE_PAY" 245 DELIVERYPURPOSECATEGORY_JUMP_MINI_APP DeliveryPurposeCategory = "JUMP_MINI_APP" 246) 247 248type FullSendRule struct { 249 TransactionAmountMinimum *int64 `json:"transaction_amount_minimum,omitempty"` 250 SendContent *SendContentCategory `json:"send_content,omitempty"` 251 AwardType *AwardType `json:"award_type,omitempty"` 252 AwardList []AwardBaseInfo `json:"award_list,omitempty"` 253 MerchantOption *SendMerchantOption `json:"merchant_option,omitempty"` 254 MerchantIdList []string `json:"merchant_id_list,omitempty"` 255} 256 257type DeliveryUserCategory string 258 259func (e DeliveryUserCategory) Ptr() *DeliveryUserCategory { 260 return &e 261} 262 263const ( 264 DELIVERYUSERCATEGORY_DELIVERY_ALL_PERSON DeliveryUserCategory = "DELIVERY_ALL_PERSON" 265 DELIVERYUSERCATEGORY_DELIVERY_MEMBER_PERSON DeliveryUserCategory = "DELIVERY_MEMBER_PERSON" 266) 267 268type PaymentMode struct { 269 PaymentSceneList []PaymentScene `json:"payment_scene_list,omitempty"` 270} 271 272type PaymentMethodInfo struct { 273 PaymentMethod *PaymentMethodCategory `json:"payment_method,omitempty"` 274 BankAbbreviation *string `json:"bank_abbreviation,omitempty"` 275} 276 277type AvailableTime struct { 278 BeginTime *string `json:"begin_time,omitempty"` 279 EndTime *string `json:"end_time,omitempty"` 280} 281 282type AvailableDayTime struct { 283 BeginDayTime *string `json:"begin_day_time,omitempty"` 284 EndDayTime *string `json:"end_day_time,omitempty"` 285} 286 287type SendContentCategory string 288 289func (e SendContentCategory) Ptr() *SendContentCategory { 290 return &e 291} 292 293const ( 294 SENDCONTENTCATEGORY_SINGLE_COUPON SendContentCategory = "SINGLE_COUPON" 295 SENDCONTENTCATEGORY_GIFT_PACKAGE SendContentCategory = "GIFT_PACKAGE" 296) 297 298type AwardBaseInfo struct { 299 StockId *string `json:"stock_id,omitempty"` 300 OriginalImageUrl *string `json:"original_image_url,omitempty"` 301 ThumbnailUrl *string `json:"thumbnail_url,omitempty"` 302} 303 304type SendMerchantOption string 305 306func (e SendMerchantOption) Ptr() *SendMerchantOption { 307 return &e 308} 309 310const ( 311 SENDMERCHANTOPTION_IN_SEVICE_COUPON_MERCHANT SendMerchantOption = "IN_SEVICE_COUPON_MERCHANT" 312 SENDMERCHANTOPTION_MANUAL_INPUT_MERCHANT SendMerchantOption = "MANUAL_INPUT_MERCHANT" 313) 314 315type PaymentScene string 316 317func (e PaymentScene) Ptr() *PaymentScene { 318 return &e 319} 320 321const ( 322 PAYMENTSCENE_APP_SCENE PaymentScene = "APP_SCENE" 323 PAYMENTSCENE_SWING_CARD_SCENE PaymentScene = "SWING_CARD_SCENE" 324 PAYMENTSCENE_NO_SECRET_SCENE PaymentScene = "NO_SECRET_SCENE" 325 PAYMENTSCENE_MINIAPP_SCENE PaymentScene = "MINIAPP_SCENE" 326 PAYMENTSCENE_FACE_PAY_SCENE PaymentScene = "FACE_PAY_SCENE" 327 PAYMENTSCENE_OTHER_SCENE PaymentScene = "OTHER_SCENE" 328) 329 330type PaymentMethodCategory string 331 332func (e PaymentMethodCategory) Ptr() *PaymentMethodCategory { 333 return &e 334} 335 336const ( 337 PAYMENTMETHODCATEGORY_CFT PaymentMethodCategory = "CFT" 338 PAYMENTMETHODCATEGORY_SPECIFIC_BANK_CARD PaymentMethodCategory = "SPECIFIC_BANK_CARD" 339) 340
应答参数
|
data 选填 array[object]
【结果集】支付有礼活动列表
属性 | |||||||||||||||||||||||||||||||||||||||||
activity_id 选填 string(20) 【活动Id】活动Id activity_type 选填 string 【活动类型】活动类型 可选取值:
activity_base_info 选填 object 【活动基本信息】创建活动时录入的基本信息
award_send_rule 选填 object 【活动奖品发放规则】奖品派送规则,分别对应满送、阶梯送、满A送B中的一种
advanced_setting 选填 object 【活动高级设置】创建时传入的高级设置信息
activity_status 选填 string 【活动状态】活动当前状态枚举值 可选取值:
creator_merchant_id 选填 string(15) 【创建商户号】创建商户号 belong_merchant_id 选填 string(15) 【所属商户号】所属商户号 create_time 选填 string 【活动创建时间】活动创建时间 update_time 选填 string 【活动更新时间】活动更新时间 |
total_count 选填 integer
【总数】总数
offset 选填 integer
【分页页码】分页页码
limit 选填 integer
【分页大小】分页大小
应答示例
200 OK
1{ 2 "data" : [ 3 { 4 "activity_id" : "10028001", 5 "activity_type" : "FULL_SEND_ACT_TYPE", 6 "activity_base_info" : { 7 "activity_name" : "良品铺子回馈活动", 8 "activity_second_title" : "海飞丝的券", 9 "merchant_logo_url" : "https://tool.oschina.net/regex.jpg", 10 "background_color" : "Color010", 11 "begin_time" : "2015-05-20T13:29:35.120+08:00", 12 "end_time" : "2015-05-20T13:29:35.120+08:00", 13 "available_periods" : { 14 "available_time" : [ 15 { 16 "begin_time" : "2015-05-20T00:00:00.000+08:00", 17 "end_time" : "2015-05-20T23:59:59.000+08:00" 18 } 19 ], 20 "available_day_time" : [ 21 { 22 "begin_day_time" : "110000", 23 "end_day_time" : "135959" 24 } 25 ] 26 }, 27 "out_request_no" : "100002322019090134234sfdf", 28 "delivery_purpose" : "OFF_LINE_PAY", 29 "mini_programs_appid" : "wx23232232323", 30 "mini_programs_path" : "/path/index/index" 31 }, 32 "award_send_rule" : { 33 "full_send_rule" : { 34 "transaction_amount_minimum" : 100, 35 "send_content" : "SINGLE_COUPON", 36 "award_type" : "BUSIFAVOR", 37 "award_list" : [ 38 { 39 "stock_id" : "98065001", 40 "original_image_url" : "https://tool.oschina.net/regex.jpg", 41 "thumbnail_url" : "https://tool.oschina.net/regex.jpg" 42 } 43 ], 44 "merchant_option" : "IN_SEVICE_COUPON_MERCHANT", 45 "merchant_id_list" : [ 46 "10000022" 47 ] 48 } 49 }, 50 "advanced_setting" : { 51 "delivery_user_category" : "DELIVERY_ALL_PERSON", 52 "merchant_member_appid" : "34567890", 53 "payment_mode" : { 54 "payment_scene_list" : [ 55 "APP_SCENE" 56 ] 57 }, 58 "payment_method_information" : { 59 "payment_method" : "CFT", 60 "bank_abbreviation" : "AHRCUB_CREDIT" 61 }, 62 "goods_tags" : [ 63 "xxx" 64 ] 65 }, 66 "activity_status" : "ACT_STATUS_UNKNOWN", 67 "creator_merchant_id" : "10000022", 68 "belong_merchant_id" : "10000022", 69 "create_time" : "2015-05-20T13:29:35.120+08:00", 70 "update_time" : "2015-05-20T13:29:35.120+08:00" 71 } 72 ], 73 "total_count" : 245, 74 "offset" : 1, 75 "limit" : 50 76} 77
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |
业务错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | APPID_MCHID_NOT_MATCH | AppID与MchID不匹配 | 请确认AppID是否正确填写 |
400 | INVALID_REQUEST | 请求参数符合参数格式,但不符合业务规则 | 根据错误提示,传入符合业务规则的参数 |
400 | MCH_NOT_EXISTS | 商户号不存在 | 请确认发券商户号信息是否有误 |
401 | SIGN_ERROR | 签名错误或签名信息不完整 | 登录商户平台核对,传入正确信息 |
403 | NO_AUTH | 商户未被授权 | 登录商户平台核对,传入正确信息 |
404 | RESOURCE_NOT_EXISTS | 资源不存在或无可用 | 请确认资源均存在且可用 |
429 | FREQUENCY_LIMITED | 频率超限 | 请求量不要超过接口调用频率限制 |
500 | SYSTEM_ERROR | 系统错误 | 请使用相同参数稍后重新调用 |