获取活动详情接口
更新时间:2024.11.18使用场景:商户创建活动后,可以通过该接口查询支付有礼的活动详情,用于管理活动。
可调用商户:商户/服务商/渠道商
接口说明
支持商户:【普通服务商】
请求方式:【GET】/v3/marketing/paygiftactivity/activities/{activity_id}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
path 路径参数
activity_id 必填 string
【活动Id】活动Id
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities/10028001 \ 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 GetActDetail { 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/{activity_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 GetActDetail client = new GetActDetail( 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 GetActDetailRequest request = new GetActDetailRequest(); 41 request.activityId = "10028001"; 42 try { 43 GetActDetailResponse response = client.run(request); 44 // TODO: 请求成功,继续业务逻辑 45 System.out.println(response); 46 } catch (WXPayUtility.ApiException e) { 47 // TODO: 请求失败,根据状态码执行不同的逻辑 48 e.printStackTrace(); 49 } 50 } 51 52 public GetActDetailResponse run(GetActDetailRequest request) { 53 String uri = PATH; 54 uri = uri.replace("{activity_id}", WXPayUtility.urlEncode(request.activityId)); 55 56 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 57 reqBuilder.addHeader("Accept", "application/json"); 58 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 59 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 60 reqBuilder.method(METHOD, null); 61 Request httpRequest = reqBuilder.build(); 62 63 // 发送HTTP请求 64 OkHttpClient client = new OkHttpClient.Builder().build(); 65 try (Response httpResponse = client.newCall(httpRequest).execute()) { 66 String respBody = WXPayUtility.extractBody(httpResponse); 67 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 68 // 2XX 成功,验证应答签名 69 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 70 httpResponse.headers(), respBody); 71 72 // 从HTTP应答报文构建返回数据 73 return WXPayUtility.fromJson(respBody, GetActDetailResponse.class); 74 } else { 75 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 76 } 77 } catch (IOException e) { 78 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 79 } 80 } 81 82 private final String mchid; 83 private final String certificateSerialNo; 84 private final PrivateKey privateKey; 85 private final String wechatPayPublicKeyId; 86 private final PublicKey wechatPayPublicKey; 87 88 public GetActDetail(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 89 this.mchid = mchid; 90 this.certificateSerialNo = certificateSerialNo; 91 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 92 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 93 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 94 } 95 96 public static class GetActDetailRequest { 97 @SerializedName("activity_id") 98 @Expose(serialize = false) 99 public String activityId; 100 } 101 102 public static class GetActDetailResponse { 103 @SerializedName("activity_id") 104 public String activityId; 105 106 @SerializedName("activity_type") 107 public ActType activityType; 108 109 @SerializedName("activity_base_info") 110 public ActBaseInfo activityBaseInfo; 111 112 @SerializedName("award_send_rule") 113 public AwardSendRule awardSendRule; 114 115 @SerializedName("advanced_setting") 116 public ActAdvancedSetting advancedSetting; 117 118 @SerializedName("activity_status") 119 public ActStatus activityStatus; 120 121 @SerializedName("creator_merchant_id") 122 public String creatorMerchantId; 123 124 @SerializedName("belong_merchant_id") 125 public String belongMerchantId; 126 127 @SerializedName("pause_time") 128 public String pauseTime; 129 130 @SerializedName("recovery_time") 131 public String recoveryTime; 132 133 @SerializedName("create_time") 134 public String createTime; 135 136 @SerializedName("update_time") 137 public String updateTime; 138 } 139 140 public enum ActType { 141 @SerializedName("FULL_SEND_ACT_TYPE") 142 FULL_SEND_ACT_TYPE, 143 @SerializedName("STEP_SEND_ACT_TYPE") 144 STEP_SEND_ACT_TYPE, 145 @SerializedName("SPECIFIC_SEND_ACT_TYPE") 146 SPECIFIC_SEND_ACT_TYPE 147 } 148 149 public static class ActBaseInfo { 150 @SerializedName("activity_name") 151 public String activityName; 152 153 @SerializedName("activity_second_title") 154 public String activitySecondTitle; 155 156 @SerializedName("merchant_logo_url") 157 public String merchantLogoUrl; 158 159 @SerializedName("background_color") 160 public String backgroundColor; 161 162 @SerializedName("begin_time") 163 public String beginTime; 164 165 @SerializedName("end_time") 166 public String endTime; 167 168 @SerializedName("available_periods") 169 public AvailablePeriod availablePeriods; 170 171 @SerializedName("out_request_no") 172 public String outRequestNo; 173 174 @SerializedName("delivery_purpose") 175 public DeliveryPurposeCategory deliveryPurpose; 176 177 @SerializedName("mini_programs_appid") 178 public String miniProgramsAppid; 179 180 @SerializedName("mini_programs_path") 181 public String miniProgramsPath; 182 } 183 184 public static class AwardSendRule { 185 @SerializedName("full_send_rule") 186 public FullSendRule fullSendRule; 187 } 188 189 public static class ActAdvancedSetting { 190 @SerializedName("delivery_user_category") 191 public DeliveryUserCategory deliveryUserCategory; 192 193 @SerializedName("merchant_member_appid") 194 public String merchantMemberAppid; 195 196 @SerializedName("payment_mode") 197 public PaymentMode paymentMode; 198 199 @SerializedName("payment_method_information") 200 public PaymentMethodInfo paymentMethodInformation; 201 202 @SerializedName("goods_tags") 203 public List<String> goodsTags; 204 } 205 206 public enum ActStatus { 207 @SerializedName("ACT_STATUS_UNKNOWN") 208 ACT_STATUS_UNKNOWN, 209 @SerializedName("CREATE_ACT_STATUS") 210 CREATE_ACT_STATUS, 211 @SerializedName("ONGOING_ACT_STATUS") 212 ONGOING_ACT_STATUS, 213 @SerializedName("TERMINATE_ACT_STATUS") 214 TERMINATE_ACT_STATUS, 215 @SerializedName("STOP_ACT_STATUS") 216 STOP_ACT_STATUS, 217 @SerializedName("OVER_TIME_ACT_STATUS") 218 OVER_TIME_ACT_STATUS, 219 @SerializedName("CREATE_ACT_FAILED") 220 CREATE_ACT_FAILED 221 } 222 223 public static class AvailablePeriod { 224 @SerializedName("available_time") 225 public List<AvailableTime> availableTime; 226 227 @SerializedName("available_day_time") 228 public List<AvailableDayTime> availableDayTime; 229 } 230 231 public enum DeliveryPurposeCategory { 232 @SerializedName("OFF_LINE_PAY") 233 OFF_LINE_PAY, 234 @SerializedName("JUMP_MINI_APP") 235 JUMP_MINI_APP 236 } 237 238 public static class FullSendRule { 239 @SerializedName("transaction_amount_minimum") 240 public Long transactionAmountMinimum; 241 242 @SerializedName("send_content") 243 public SendContentCategory sendContent; 244 245 @SerializedName("award_type") 246 public AwardType awardType; 247 248 @SerializedName("award_list") 249 public List<AwardBaseInfo> awardList = new ArrayList<AwardBaseInfo>(); 250 251 @SerializedName("merchant_option") 252 public SendMerchantOption merchantOption; 253 254 @SerializedName("merchant_id_list") 255 public List<String> merchantIdList; 256 } 257 258 public enum DeliveryUserCategory { 259 @SerializedName("DELIVERY_ALL_PERSON") 260 DELIVERY_ALL_PERSON, 261 @SerializedName("DELIVERY_MEMBER_PERSON") 262 DELIVERY_MEMBER_PERSON 263 } 264 265 public static class PaymentMode { 266 @SerializedName("payment_scene_list") 267 public List<PaymentScene> paymentSceneList; 268 } 269 270 public static class PaymentMethodInfo { 271 @SerializedName("payment_method") 272 public PaymentMethodCategory paymentMethod; 273 274 @SerializedName("bank_abbreviation") 275 public String bankAbbreviation; 276 } 277 278 public static class AvailableTime { 279 @SerializedName("begin_time") 280 public String beginTime; 281 282 @SerializedName("end_time") 283 public String endTime; 284 } 285 286 public static class AvailableDayTime { 287 @SerializedName("begin_day_time") 288 public String beginDayTime; 289 290 @SerializedName("end_day_time") 291 public String endDayTime; 292 } 293 294 public enum SendContentCategory { 295 @SerializedName("SINGLE_COUPON") 296 SINGLE_COUPON, 297 @SerializedName("GIFT_PACKAGE") 298 GIFT_PACKAGE 299 } 300 301 public enum AwardType { 302 @SerializedName("BUSIFAVOR") 303 BUSIFAVOR 304 } 305 306 public static class AwardBaseInfo { 307 @SerializedName("stock_id") 308 public String stockId; 309 310 @SerializedName("original_image_url") 311 public String originalImageUrl; 312 313 @SerializedName("thumbnail_url") 314 public String thumbnailUrl; 315 } 316 317 public enum SendMerchantOption { 318 @SerializedName("IN_SEVICE_COUPON_MERCHANT") 319 IN_SEVICE_COUPON_MERCHANT, 320 @SerializedName("MANUAL_INPUT_MERCHANT") 321 MANUAL_INPUT_MERCHANT 322 } 323 324 public enum PaymentScene { 325 @SerializedName("APP_SCENE") 326 APP_SCENE, 327 @SerializedName("SWING_CARD_SCENE") 328 SWING_CARD_SCENE, 329 @SerializedName("NO_SECRET_SCENE") 330 NO_SECRET_SCENE, 331 @SerializedName("MINIAPP_SCENE") 332 MINIAPP_SCENE, 333 @SerializedName("FACE_PAY_SCENE") 334 FACE_PAY_SCENE, 335 @SerializedName("OTHER_SCENE") 336 OTHER_SCENE 337 } 338 339 public enum PaymentMethodCategory { 340 @SerializedName("CFT") 341 CFT, 342 @SerializedName("SPECIFIC_BANK_CARD") 343 SPECIFIC_BANK_CARD 344 } 345 346} 347
需配合微信支付工具库 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 "strings" 10) 11 12func main() { 13 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 14 config, err := wxpay_utility.CreateMchConfig( 15 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/partner/4013080340 16 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013058924 17 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 18 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/partner/4013038589 19 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 20 ) 21 if err != nil { 22 fmt.Println(err) 23 return 24 } 25 26 request := &GetActDetailRequest{ 27 ActivityId: wxpay_utility.String("10028001"), 28 } 29 30 response, err := GetActDetail(config, request) 31 if err != nil { 32 fmt.Printf("请求失败: %+v\n", err) 33 // TODO: 请求失败,根据状态码执行不同的处理 34 return 35 } 36 37 // TODO: 请求成功,继续业务逻辑 38 fmt.Printf("请求成功: %+v\n", response) 39} 40 41func GetActDetail(config *wxpay_utility.MchConfig, request *GetActDetailRequest) (response *GetActDetailResponse, err error) { 42 const ( 43 host = "https://api.mch.weixin.qq.com" 44 method = "GET" 45 path = "/v3/marketing/paygiftactivity/activities/{activity_id}" 46 ) 47 48 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 49 if err != nil { 50 return nil, err 51 } 52 reqUrl.Path = strings.Replace(reqUrl.Path, "{activity_id}", url.PathEscape(*request.ActivityId), -1) 53 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 54 if err != nil { 55 return nil, err 56 } 57 httpRequest.Header.Set("Accept", "application/json") 58 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 59 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 60 if err != nil { 61 return nil, err 62 } 63 httpRequest.Header.Set("Authorization", authorization) 64 65 client := &http.Client{} 66 httpResponse, err := client.Do(httpRequest) 67 if err != nil { 68 return nil, err 69 } 70 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 71 if err != nil { 72 return nil, err 73 } 74 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 75 // 2XX 成功,验证应答签名 76 err = wxpay_utility.ValidateResponse( 77 config.WechatPayPublicKeyId(), 78 config.WechatPayPublicKey(), 79 &httpResponse.Header, 80 respBody, 81 ) 82 if err != nil { 83 return nil, err 84 } 85 response := &GetActDetailResponse{} 86 if err := json.Unmarshal(respBody, response); err != nil { 87 return nil, err 88 } 89 90 return response, nil 91 } else { 92 return nil, wxpay_utility.NewApiException( 93 httpResponse.StatusCode, 94 httpResponse.Header, 95 respBody, 96 ) 97 } 98} 99 100type GetActDetailRequest struct { 101 ActivityId *string `json:"activity_id,omitempty"` 102} 103 104func (o *GetActDetailRequest) MarshalJSON() ([]byte, error) { 105 type Alias GetActDetailRequest 106 a := &struct { 107 ActivityId *string `json:"activity_id,omitempty"` 108 *Alias 109 }{ 110 // 序列化时移除非 Body 字段 111 ActivityId: nil, 112 Alias: (*Alias)(o), 113 } 114 return json.Marshal(a) 115} 116 117type GetActDetailResponse struct { 118 ActivityId *string `json:"activity_id,omitempty"` 119 ActivityType *ActType `json:"activity_type,omitempty"` 120 ActivityBaseInfo *ActBaseInfo `json:"activity_base_info,omitempty"` 121 AwardSendRule *AwardSendRule `json:"award_send_rule,omitempty"` 122 AdvancedSetting *ActAdvancedSetting `json:"advanced_setting,omitempty"` 123 ActivityStatus *ActStatus `json:"activity_status,omitempty"` 124 CreatorMerchantId *string `json:"creator_merchant_id,omitempty"` 125 BelongMerchantId *string `json:"belong_merchant_id,omitempty"` 126 PauseTime *string `json:"pause_time,omitempty"` 127 RecoveryTime *string `json:"recovery_time,omitempty"` 128 CreateTime *string `json:"create_time,omitempty"` 129 UpdateTime *string `json:"update_time,omitempty"` 130} 131 132type ActType string 133 134func (e ActType) Ptr() *ActType { 135 return &e 136} 137 138const ( 139 ACTTYPE_FULL_SEND_ACT_TYPE ActType = "FULL_SEND_ACT_TYPE" 140 ACTTYPE_STEP_SEND_ACT_TYPE ActType = "STEP_SEND_ACT_TYPE" 141 ACTTYPE_SPECIFIC_SEND_ACT_TYPE ActType = "SPECIFIC_SEND_ACT_TYPE" 142) 143 144type ActBaseInfo struct { 145 ActivityName *string `json:"activity_name,omitempty"` 146 ActivitySecondTitle *string `json:"activity_second_title,omitempty"` 147 MerchantLogoUrl *string `json:"merchant_logo_url,omitempty"` 148 BackgroundColor *string `json:"background_color,omitempty"` 149 BeginTime *string `json:"begin_time,omitempty"` 150 EndTime *string `json:"end_time,omitempty"` 151 AvailablePeriods *AvailablePeriod `json:"available_periods,omitempty"` 152 OutRequestNo *string `json:"out_request_no,omitempty"` 153 DeliveryPurpose *DeliveryPurposeCategory `json:"delivery_purpose,omitempty"` 154 MiniProgramsAppid *string `json:"mini_programs_appid,omitempty"` 155 MiniProgramsPath *string `json:"mini_programs_path,omitempty"` 156} 157 158type AwardSendRule struct { 159 FullSendRule *FullSendRule `json:"full_send_rule,omitempty"` 160} 161 162type ActAdvancedSetting struct { 163 DeliveryUserCategory *DeliveryUserCategory `json:"delivery_user_category,omitempty"` 164 MerchantMemberAppid *string `json:"merchant_member_appid,omitempty"` 165 PaymentMode *PaymentMode `json:"payment_mode,omitempty"` 166 PaymentMethodInformation *PaymentMethodInfo `json:"payment_method_information,omitempty"` 167 GoodsTags []string `json:"goods_tags,omitempty"` 168} 169 170type ActStatus string 171 172func (e ActStatus) Ptr() *ActStatus { 173 return &e 174} 175 176const ( 177 ACTSTATUS_ACT_STATUS_UNKNOWN ActStatus = "ACT_STATUS_UNKNOWN" 178 ACTSTATUS_CREATE_ACT_STATUS ActStatus = "CREATE_ACT_STATUS" 179 ACTSTATUS_ONGOING_ACT_STATUS ActStatus = "ONGOING_ACT_STATUS" 180 ACTSTATUS_TERMINATE_ACT_STATUS ActStatus = "TERMINATE_ACT_STATUS" 181 ACTSTATUS_STOP_ACT_STATUS ActStatus = "STOP_ACT_STATUS" 182 ACTSTATUS_OVER_TIME_ACT_STATUS ActStatus = "OVER_TIME_ACT_STATUS" 183 ACTSTATUS_CREATE_ACT_FAILED ActStatus = "CREATE_ACT_FAILED" 184) 185 186type AvailablePeriod struct { 187 AvailableTime []AvailableTime `json:"available_time,omitempty"` 188 AvailableDayTime []AvailableDayTime `json:"available_day_time,omitempty"` 189} 190 191type DeliveryPurposeCategory string 192 193func (e DeliveryPurposeCategory) Ptr() *DeliveryPurposeCategory { 194 return &e 195} 196 197const ( 198 DELIVERYPURPOSECATEGORY_OFF_LINE_PAY DeliveryPurposeCategory = "OFF_LINE_PAY" 199 DELIVERYPURPOSECATEGORY_JUMP_MINI_APP DeliveryPurposeCategory = "JUMP_MINI_APP" 200) 201 202type FullSendRule struct { 203 TransactionAmountMinimum *int64 `json:"transaction_amount_minimum,omitempty"` 204 SendContent *SendContentCategory `json:"send_content,omitempty"` 205 AwardType *AwardType `json:"award_type,omitempty"` 206 AwardList []AwardBaseInfo `json:"award_list,omitempty"` 207 MerchantOption *SendMerchantOption `json:"merchant_option,omitempty"` 208 MerchantIdList []string `json:"merchant_id_list,omitempty"` 209} 210 211type DeliveryUserCategory string 212 213func (e DeliveryUserCategory) Ptr() *DeliveryUserCategory { 214 return &e 215} 216 217const ( 218 DELIVERYUSERCATEGORY_DELIVERY_ALL_PERSON DeliveryUserCategory = "DELIVERY_ALL_PERSON" 219 DELIVERYUSERCATEGORY_DELIVERY_MEMBER_PERSON DeliveryUserCategory = "DELIVERY_MEMBER_PERSON" 220) 221 222type PaymentMode struct { 223 PaymentSceneList []PaymentScene `json:"payment_scene_list,omitempty"` 224} 225 226type PaymentMethodInfo struct { 227 PaymentMethod *PaymentMethodCategory `json:"payment_method,omitempty"` 228 BankAbbreviation *string `json:"bank_abbreviation,omitempty"` 229} 230 231type AvailableTime struct { 232 BeginTime *string `json:"begin_time,omitempty"` 233 EndTime *string `json:"end_time,omitempty"` 234} 235 236type AvailableDayTime struct { 237 BeginDayTime *string `json:"begin_day_time,omitempty"` 238 EndDayTime *string `json:"end_day_time,omitempty"` 239} 240 241type SendContentCategory string 242 243func (e SendContentCategory) Ptr() *SendContentCategory { 244 return &e 245} 246 247const ( 248 SENDCONTENTCATEGORY_SINGLE_COUPON SendContentCategory = "SINGLE_COUPON" 249 SENDCONTENTCATEGORY_GIFT_PACKAGE SendContentCategory = "GIFT_PACKAGE" 250) 251 252type AwardType string 253 254func (e AwardType) Ptr() *AwardType { 255 return &e 256} 257 258const ( 259 AWARDTYPE_BUSIFAVOR AwardType = "BUSIFAVOR" 260) 261 262type AwardBaseInfo struct { 263 StockId *string `json:"stock_id,omitempty"` 264 OriginalImageUrl *string `json:"original_image_url,omitempty"` 265 ThumbnailUrl *string `json:"thumbnail_url,omitempty"` 266} 267 268type SendMerchantOption string 269 270func (e SendMerchantOption) Ptr() *SendMerchantOption { 271 return &e 272} 273 274const ( 275 SENDMERCHANTOPTION_IN_SEVICE_COUPON_MERCHANT SendMerchantOption = "IN_SEVICE_COUPON_MERCHANT" 276 SENDMERCHANTOPTION_MANUAL_INPUT_MERCHANT SendMerchantOption = "MANUAL_INPUT_MERCHANT" 277) 278 279type PaymentScene string 280 281func (e PaymentScene) Ptr() *PaymentScene { 282 return &e 283} 284 285const ( 286 PAYMENTSCENE_APP_SCENE PaymentScene = "APP_SCENE" 287 PAYMENTSCENE_SWING_CARD_SCENE PaymentScene = "SWING_CARD_SCENE" 288 PAYMENTSCENE_NO_SECRET_SCENE PaymentScene = "NO_SECRET_SCENE" 289 PAYMENTSCENE_MINIAPP_SCENE PaymentScene = "MINIAPP_SCENE" 290 PAYMENTSCENE_FACE_PAY_SCENE PaymentScene = "FACE_PAY_SCENE" 291 PAYMENTSCENE_OTHER_SCENE PaymentScene = "OTHER_SCENE" 292) 293 294type PaymentMethodCategory string 295 296func (e PaymentMethodCategory) Ptr() *PaymentMethodCategory { 297 return &e 298} 299 300const ( 301 PAYMENTMETHODCATEGORY_CFT PaymentMethodCategory = "CFT" 302 PAYMENTMETHODCATEGORY_SPECIFIC_BANK_CARD PaymentMethodCategory = "SPECIFIC_BANK_CARD" 303) 304
应答参数
|
activity_id 必填 string(20)
【活动Id】活动Id
activity_type 选填 string
【活动类型】活动类型
可选取值:
FULL_SEND_ACT_TYPE
: 满额送
STEP_SEND_ACT_TYPE
: 阶梯送
SPECIFIC_SEND_ACT_TYPE
: 满A送B
activity_base_info 必填 object
【活动基本信息】创建活动时录入的基本信息
属性 | |||||||||||||
activity_name 必填 string(10) 【活动名称】活动名称 activity_second_title 必填 string(9) 【活动副标题】活动副标题 merchant_logo_url 必填 string(128) 【商户logo】商户logo,送出优惠券时展示 background_color 选填 string 【背景颜色】代金券的背景颜色,可设置10种颜色,颜色取值可参考开发指引 3.2.1 background_color取值,默认为微信支付绿色, 颜色取值为颜色图中的颜色名称。 begin_time 必填 string(32) 【活动开始时间】活动开始时间,最长可以配置1年内的活动,活动有效期最长90天 end_time 必填 string(32) 【活动结束时间】活动结束时间,最长可以配置1年内的活动,活动有效期最长90天 available_periods 选填 object 【可用时间段】可自定义活动有效时间内可用的多个时间段以及天内时间点
out_request_no 必填 string(128) 【商户请求单号】商户创建批次凭据号(格式:商户id+日期+流水号),商户侧需保持唯一性,可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号 delivery_purpose 必填 string 【投放目的】OFF_LINE_PAY:拉用户回店消费;JUMP_MINI_APP:引导用户前往小程序消费 可选取值:
mini_programs_appid 选填 string(32) 【商家小程序appid】投放目的为跳转小程序时必填 mini_programs_path 选填 string(128) 【商家小程序path】投放目的为跳转小程序必填 |
award_send_rule 必填 object
【活动奖品发放规则】奖品派送规则,分别对应满送、阶梯送、满A送B中的一种
属性 | |||||||||
full_send_rule 选填 object 【满送活动奖品发放规则】
|
advanced_setting 选填 object
【活动高级设置】创建时传入的高级设置信息
属性 | |||||||||
delivery_user_category 选填 string 【投放用户类别】DELIVERY_ALL_PERSON:所有用户;DELIVERY_MEMBER_PERSON:会员用户 可选取值:
merchant_member_appid 选填 string(32) 【商家会员appid】当投放用户类别为会员用户时必填 payment_mode 选填 object 【支付模式】主要用于指定可用的支付场景,不限制支付模式不填,限制选填(商家券暂不开放)
payment_method_information 选填 object 【支付方式信息】支付方式信息,不填为不限制(商家券暂不开放)
goods_tags 选填 array[string(15)] 【订单优惠标记】商户下单时需要传入相同的标记(goods_tag),用户同时符合其他规则才能享受优惠 |
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
: 创建活动失败
creator_merchant_id 必填 string(15)
【创建商户号】创建商户号
belong_merchant_id 必填 string(15)
【所属商户号】所属商户号
pause_time 选填 string
【活动暂停时间】活动暂停时间
recovery_time 选填 string
【活动恢复时间】活动恢复时间
create_time 选填 string
【活动创建时间】活动创建时间
update_time 选填 string
【活动更新时间】活动更新时间
应答示例
200 OK
1{ 2 "activity_id" : "10028001", 3 "activity_type" : "FULL_SEND_ACT_TYPE", 4 "activity_base_info" : { 5 "activity_name" : "良品铺子回馈活动", 6 "activity_second_title" : "海飞丝的券", 7 "merchant_logo_url" : "https://tool.oschina.net/regex.jpg", 8 "background_color" : "Color010", 9 "begin_time" : "2015-05-20T13:29:35.120+08:00", 10 "end_time" : "2015-05-20T13:29:35.120+08:00", 11 "available_periods" : { 12 "available_time" : [ 13 { 14 "begin_time" : "2015-05-20T00:00:00.000+08:00", 15 "end_time" : "2015-05-20T23:59:59.000+08:00" 16 } 17 ], 18 "available_day_time" : [ 19 { 20 "begin_day_time" : "110000", 21 "end_day_time" : "135959" 22 } 23 ] 24 }, 25 "out_request_no" : "100002322019090134234sfdf", 26 "delivery_purpose" : "OFF_LINE_PAY", 27 "mini_programs_appid" : "wx23232232323", 28 "mini_programs_path" : "/path/index/index" 29 }, 30 "award_send_rule" : { 31 "full_send_rule" : { 32 "transaction_amount_minimum" : 100, 33 "send_content" : "SINGLE_COUPON", 34 "award_type" : "BUSIFAVOR", 35 "award_list" : [ 36 { 37 "stock_id" : "98065001", 38 "original_image_url" : "https://tool.oschina.net/regex.jpg", 39 "thumbnail_url" : "https://tool.oschina.net/regex.jpg" 40 } 41 ], 42 "merchant_option" : "IN_SEVICE_COUPON_MERCHANT", 43 "merchant_id_list" : [ 44 "10000022" 45 ] 46 } 47 }, 48 "advanced_setting" : { 49 "delivery_user_category" : "DELIVERY_ALL_PERSON", 50 "merchant_member_appid" : "34567890", 51 "payment_mode" : { 52 "payment_scene_list" : [ 53 "APP_SCENE" 54 ] 55 }, 56 "payment_method_information" : { 57 "payment_method" : "CFT", 58 "bank_abbreviation" : "AHRCUB_CREDIT" 59 }, 60 "goods_tags" : [ 61 "xxx" 62 ] 63 }, 64 "activity_status" : "ACT_STATUS_UNKNOWN", 65 "creator_merchant_id" : "10000022", 66 "belong_merchant_id" : "10000022", 67 "pause_time" : "2015-05-20T13:29:35.120+08:00", 68 "recovery_time" : "2015-05-20T13:29:35.120+08:00", 69 "create_time" : "2015-05-20T13:29:35.120+08:00", 70 "update_time" : "2015-05-20T13:29:35.120+08:00" 71} 72
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
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 | 系统错误 | 请使用相同参数稍后重新调用 |