扣费受理
更新时间:2025.03.11商户请求扣费受理接口,会完成订单受理。微信支付进行异步扣款,支付完成后,会将订单支付结果发送给商户。
接口说明
支持商户:【普通商户】
请求方式:【POST】/v3/vehicle/transactions/parking
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
Content-Type 必填 string
请设置为application/json
body 包体参数
appid 必填 string(32)
【公众账号ID】 AppID是商户在微信申请公众号或移动应用成功后分配的账号ID,登录平台为mp.weixin.qq.com或open.weixin.qq.com
description 必填 string(128)
【服务描述】商户自定义字段,用于交易账单中对扣费服务的描述。
attach 选填 string(128)
【附加数据】附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
out_trade_no 必填 string(32)
【商户订单号】商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
trade_scene 必填 string(16)
【交易场景】交易场景值,目前支持 :PARKING:车场停车场景
goods_tag 选填 string(32)
【订单优惠标记】代金券或立减优惠功能的参数,说明详见代金券或立减优惠
notify_url 必填 string(256)
【回调通知URL】接受扣款结果异步回调通知的URL,注意回调URL只接受HTTPS
profit_sharing 选填 string(16)
【分账标识】Y:是,需要分账
N:否,不分账
字母要求大写,不传默认不分账,分账详细说明见直连分账API、服务商分账API文档
amount 必填 object
【订单金额】订单金额信息
属性 | |
total 必填 integer 【订单金额】订单总金额,单位为分,只能为整数 currency 选填 string(16) 【货币类型】符合ISO 4217标准的三位字母代码,目前只支持人民币:CNY |
parking_info 选填 object
【停车场景信息】当交易场景为PARKING时,需要在该字段添加停车场景信息
属性 | |
parking_id 必填 string(32) 【入场ID】微信支付分停车服务为商户分配的入场ID,商户通过入场通知接口获取入场ID plate_number 必填 string(32) 【车牌号】车牌号,仅包括省份+车牌,不包括特殊字符。 plate_color 必填 string 【车牌颜色】车牌颜色 可选取值:
start_time 必填 string(32) 【入场时间】用户入场时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 end_time 必填 string(32) 【出场时间】用户出场时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 parking_name 必填 string(32) 【停车场名称】所在停车位车场的名称 charging_duration 必填 integer 【计费时长】计费的时间长,单位为秒 device_id 必填 string(32) 【停车场设备ID】停车场设备ID |
请求示例
POST
1curl -X POST \ 2 https://api.mch.weixin.qq.com/v3/vehicle/transactions/parking \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" \ 5 -H "Content-Type: application/json" \ 6 -d '{ 7 "appid" : "wxcbda96de0b165486", 8 "description" : "停车场扣费", 9 "attach" : "深圳分店", 10 "out_trade_no" : "20150806125346", 11 "trade_scene" : "PARKING", 12 "goods_tag" : "WXG", 13 "notify_url" : "https://www.weixin.qq.com/wxpay/pay.php", 14 "profit_sharing" : "Y", 15 "amount" : { 16 "total" : 888, 17 "currency" : "CNY" 18 }, 19 "parking_info" : { 20 "parking_id" : "5K8264ILTKCH16CQ250", 21 "plate_number" : "粤B888888", 22 "plate_color" : "BLUE", 23 "start_time" : "2017-08-26T10:43:39+08:00", 24 "end_time" : "2017-08-26T10:43:39+08:00", 25 "parking_name" : "欢乐海岸停车场", 26 "charging_duration" : 3600, 27 "device_id" : "12313" 28 } 29 }' 30
需配合微信支付工具库 WXPayUtility 使用,请参考Java
1package com.java.demo; 2 3import com.java.utils.WXPayUtility; // 引用微信支付工具库,参考:https://pay.weixin.qq.com/doc/v3/merchant/4014931831 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 CreateTransaction { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "POST"; 28 private static String PATH = "/v3/vehicle/transactions/parking"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/merchant/4013070756 32 CreateTransaction client = new CreateTransaction( 33 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756 34 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053 35 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 36 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816 37 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 38 ); 39 40 CreateTransactionRequest request = new CreateTransactionRequest(); 41 request.appid = "wxcbda96de0b165486"; 42 request.description = "停车场扣费"; 43 request.attach = "深圳分店"; 44 request.outTradeNo = "20150806125346"; 45 request.tradeScene = "PARKING"; 46 request.goodsTag = "WXG"; 47 request.notifyUrl = "https://www.weixin.qq.com/wxpay/pay.php"; 48 request.profitSharing = "Y"; 49 request.amount = new OrderAmount(); 50 request.amount.total = 888L; 51 request.amount.currency = "CNY"; 52 request.parkingInfo = new ParkingTradeScene(); 53 request.parkingInfo.parkingId = "5K8264ILTKCH16CQ250"; 54 request.parkingInfo.plateNumber = "粤B888888"; 55 request.parkingInfo.plateColor = PlateColor.BLUE; 56 request.parkingInfo.startTime = "2017-08-26T10:43:39+08:00"; 57 request.parkingInfo.endTime = "2017-08-26T10:43:39+08:00"; 58 request.parkingInfo.parkingName = "欢乐海岸停车场"; 59 request.parkingInfo.chargingDuration = 3600L; 60 request.parkingInfo.deviceId = "12313"; 61 try { 62 Transaction response = client.run(request); 63 // TODO: 请求成功,继续业务逻辑 64 System.out.println(response); 65 } catch (WXPayUtility.ApiException e) { 66 // TODO: 请求失败,根据状态码执行不同的逻辑 67 e.printStackTrace(); 68 } 69 } 70 71 public Transaction run(CreateTransactionRequest request) { 72 String uri = PATH; 73 String reqBody = WXPayUtility.toJson(request); 74 75 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 76 reqBuilder.addHeader("Accept", "application/json"); 77 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 78 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 79 reqBuilder.addHeader("Content-Type", "application/json"); 80 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 81 reqBuilder.method(METHOD, requestBody); 82 Request httpRequest = reqBuilder.build(); 83 84 // 发送HTTP请求 85 OkHttpClient client = new OkHttpClient.Builder().build(); 86 try (Response httpResponse = client.newCall(httpRequest).execute()) { 87 String respBody = WXPayUtility.extractBody(httpResponse); 88 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 89 // 2XX 成功,验证应答签名 90 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 91 httpResponse.headers(), respBody); 92 93 // 从HTTP应答报文构建返回数据 94 return WXPayUtility.fromJson(respBody, Transaction.class); 95 } else { 96 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 97 } 98 } catch (IOException e) { 99 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 100 } 101 } 102 103 private final String mchid; 104 private final String certificateSerialNo; 105 private final PrivateKey privateKey; 106 private final String wechatPayPublicKeyId; 107 private final PublicKey wechatPayPublicKey; 108 109 public CreateTransaction(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 110 this.mchid = mchid; 111 this.certificateSerialNo = certificateSerialNo; 112 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 113 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 114 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 115 } 116 117 public static class CreateTransactionRequest { 118 @SerializedName("appid") 119 public String appid; 120 121 @SerializedName("description") 122 public String description; 123 124 @SerializedName("attach") 125 public String attach; 126 127 @SerializedName("out_trade_no") 128 public String outTradeNo; 129 130 @SerializedName("trade_scene") 131 public String tradeScene; 132 133 @SerializedName("goods_tag") 134 public String goodsTag; 135 136 @SerializedName("notify_url") 137 public String notifyUrl; 138 139 @SerializedName("profit_sharing") 140 public String profitSharing; 141 142 @SerializedName("amount") 143 public OrderAmount amount; 144 145 @SerializedName("parking_info") 146 public ParkingTradeScene parkingInfo; 147 } 148 149 public static class Transaction { 150 @SerializedName("appid") 151 public String appid; 152 153 @SerializedName("sp_mchid") 154 public String spMchid; 155 156 @SerializedName("description") 157 public String description; 158 159 @SerializedName("create_time") 160 public String createTime; 161 162 @SerializedName("out_trade_no") 163 public String outTradeNo; 164 165 @SerializedName("transaction_id") 166 public String transactionId; 167 168 @SerializedName("trade_state") 169 public String tradeState; 170 171 @SerializedName("trade_state_description") 172 public String tradeStateDescription; 173 174 @SerializedName("success_time") 175 public String successTime; 176 177 @SerializedName("bank_type") 178 public String bankType; 179 180 @SerializedName("user_repaid") 181 public String userRepaid; 182 183 @SerializedName("attach") 184 public String attach; 185 186 @SerializedName("trade_scene") 187 public String tradeScene; 188 189 @SerializedName("parking_info") 190 public ParkingTradeScene parkingInfo; 191 192 @SerializedName("payer") 193 public Payer payer; 194 195 @SerializedName("amount") 196 public QueryOrderAmount amount; 197 198 @SerializedName("promotion_detail") 199 public List<PromotionDetail> promotionDetail; 200 } 201 202 public static class OrderAmount { 203 @SerializedName("total") 204 public Long total; 205 206 @SerializedName("currency") 207 public String currency; 208 } 209 210 public static class ParkingTradeScene { 211 @SerializedName("parking_id") 212 public String parkingId; 213 214 @SerializedName("plate_number") 215 public String plateNumber; 216 217 @SerializedName("plate_color") 218 public PlateColor plateColor; 219 220 @SerializedName("start_time") 221 public String startTime; 222 223 @SerializedName("end_time") 224 public String endTime; 225 226 @SerializedName("parking_name") 227 public String parkingName; 228 229 @SerializedName("charging_duration") 230 public Long chargingDuration; 231 232 @SerializedName("device_id") 233 public String deviceId; 234 } 235 236 public static class Payer { 237 @SerializedName("openid") 238 public String openid; 239 } 240 241 public static class QueryOrderAmount { 242 @SerializedName("total") 243 public Long total; 244 245 @SerializedName("currency") 246 public String currency; 247 248 @SerializedName("payer_total") 249 public Long payerTotal; 250 251 @SerializedName("discount_total") 252 public Long discountTotal; 253 } 254 255 public static class PromotionDetail { 256 @SerializedName("coupon_id") 257 public String couponId; 258 259 @SerializedName("name") 260 public String name; 261 262 @SerializedName("scope") 263 public String scope; 264 265 @SerializedName("type") 266 public String type; 267 268 @SerializedName("stock_id") 269 public String stockId; 270 271 @SerializedName("amount") 272 public Long amount; 273 274 @SerializedName("wechatpay_contribute") 275 public Long wechatpayContribute; 276 277 @SerializedName("merchant_contribute") 278 public Long merchantContribute; 279 280 @SerializedName("other_contribute") 281 public Long otherContribute; 282 283 @SerializedName("currency") 284 public String currency; 285 } 286 287 public enum PlateColor { 288 @SerializedName("BLUE") 289 BLUE, 290 @SerializedName("GREEN") 291 GREEN, 292 @SerializedName("YELLOW") 293 YELLOW, 294 @SerializedName("BLACK") 295 BLACK, 296 @SerializedName("WHITE") 297 WHITE, 298 @SerializedName("LIMEGREEN") 299 LIMEGREEN 300 } 301 302} 303
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "bytes" 5 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/merchant/4015119334 6 "encoding/json" 7 "fmt" 8 "net/http" 9 "net/url" 10 "time" 11) 12 13func main() { 14 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/merchant/4013070756 15 config, err := wxpay_utility.CreateMchConfig( 16 "19xxxxxxxx", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756 17 "1DDE55AD98Exxxxxxxxxx", // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053 18 "/path/to/apiclient_key.pem", // 商户API证书私钥文件路径,本地文件路径 19 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816 20 "/path/to/wxp_pub.pem", // 微信支付公钥文件路径,本地文件路径 21 ) 22 if err != nil { 23 fmt.Println(err) 24 return 25 } 26 27 request := &CreateTransactionRequest{ 28 Appid: wxpay_utility.String("wxcbda96de0b165486"), 29 Description: wxpay_utility.String("停车场扣费"), 30 Attach: wxpay_utility.String("深圳分店"), 31 OutTradeNo: wxpay_utility.String("20150806125346"), 32 TradeScene: wxpay_utility.String("PARKING"), 33 GoodsTag: wxpay_utility.String("WXG"), 34 NotifyUrl: wxpay_utility.String("https://www.weixin.qq.com/wxpay/pay.php"), 35 ProfitSharing: wxpay_utility.String("Y"), 36 Amount: &OrderAmount{ 37 Total: wxpay_utility.Int64(888), 38 Currency: wxpay_utility.String("CNY"), 39 }, 40 ParkingInfo: &ParkingTradeScene{ 41 ParkingId: wxpay_utility.String("5K8264ILTKCH16CQ250"), 42 PlateNumber: wxpay_utility.String("粤B888888"), 43 PlateColor: PLATECOLOR_BLUE.Ptr(), 44 StartTime: wxpay_utility.Time(time.Now()), 45 EndTime: wxpay_utility.Time(time.Now()), 46 ParkingName: wxpay_utility.String("欢乐海岸停车场"), 47 ChargingDuration: wxpay_utility.Int64(3600), 48 DeviceId: wxpay_utility.String("12313"), 49 }, 50 } 51 52 response, err := CreateTransaction(config, request) 53 if err != nil { 54 fmt.Printf("请求失败: %+v\n", err) 55 // TODO: 请求失败,根据状态码执行不同的处理 56 return 57 } 58 59 // TODO: 请求成功,继续业务逻辑 60 fmt.Printf("请求成功: %+v\n", response) 61} 62 63func CreateTransaction(config *wxpay_utility.MchConfig, request *CreateTransactionRequest) (response *Transaction, err error) { 64 const ( 65 host = "https://api.mch.weixin.qq.com" 66 method = "POST" 67 path = "/v3/vehicle/transactions/parking" 68 ) 69 70 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 71 if err != nil { 72 return nil, err 73 } 74 reqBody, err := json.Marshal(request) 75 if err != nil { 76 return nil, err 77 } 78 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 79 if err != nil { 80 return nil, err 81 } 82 httpRequest.Header.Set("Accept", "application/json") 83 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 84 httpRequest.Header.Set("Content-Type", "application/json") 85 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody) 86 if err != nil { 87 return nil, err 88 } 89 httpRequest.Header.Set("Authorization", authorization) 90 91 client := &http.Client{} 92 httpResponse, err := client.Do(httpRequest) 93 if err != nil { 94 return nil, err 95 } 96 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 97 if err != nil { 98 return nil, err 99 } 100 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 101 // 2XX 成功,验证应答签名 102 err = wxpay_utility.ValidateResponse( 103 config.WechatPayPublicKeyId(), 104 config.WechatPayPublicKey(), 105 &httpResponse.Header, 106 respBody, 107 ) 108 if err != nil { 109 return nil, err 110 } 111 response := &Transaction{} 112 if err := json.Unmarshal(respBody, response); err != nil { 113 return nil, err 114 } 115 116 return response, nil 117 } else { 118 return nil, wxpay_utility.NewApiException( 119 httpResponse.StatusCode, 120 httpResponse.Header, 121 respBody, 122 ) 123 } 124} 125 126type CreateTransactionRequest struct { 127 Appid *string `json:"appid,omitempty"` 128 Description *string `json:"description,omitempty"` 129 Attach *string `json:"attach,omitempty"` 130 OutTradeNo *string `json:"out_trade_no,omitempty"` 131 TradeScene *string `json:"trade_scene,omitempty"` 132 GoodsTag *string `json:"goods_tag,omitempty"` 133 NotifyUrl *string `json:"notify_url,omitempty"` 134 ProfitSharing *string `json:"profit_sharing,omitempty"` 135 Amount *OrderAmount `json:"amount,omitempty"` 136 ParkingInfo *ParkingTradeScene `json:"parking_info,omitempty"` 137} 138 139type Transaction struct { 140 Appid *string `json:"appid,omitempty"` 141 SpMchid *string `json:"sp_mchid,omitempty"` 142 Description *string `json:"description,omitempty"` 143 CreateTime *time.Time `json:"create_time,omitempty"` 144 OutTradeNo *string `json:"out_trade_no,omitempty"` 145 TransactionId *string `json:"transaction_id,omitempty"` 146 TradeState *string `json:"trade_state,omitempty"` 147 TradeStateDescription *string `json:"trade_state_description,omitempty"` 148 SuccessTime *time.Time `json:"success_time,omitempty"` 149 BankType *string `json:"bank_type,omitempty"` 150 UserRepaid *string `json:"user_repaid,omitempty"` 151 Attach *string `json:"attach,omitempty"` 152 TradeScene *string `json:"trade_scene,omitempty"` 153 ParkingInfo *ParkingTradeScene `json:"parking_info,omitempty"` 154 Payer *Payer `json:"payer,omitempty"` 155 Amount *QueryOrderAmount `json:"amount,omitempty"` 156 PromotionDetail []PromotionDetail `json:"promotion_detail,omitempty"` 157} 158 159type OrderAmount struct { 160 Total *int64 `json:"total,omitempty"` 161 Currency *string `json:"currency,omitempty"` 162} 163 164type ParkingTradeScene struct { 165 ParkingId *string `json:"parking_id,omitempty"` 166 PlateNumber *string `json:"plate_number,omitempty"` 167 PlateColor *PlateColor `json:"plate_color,omitempty"` 168 StartTime *time.Time `json:"start_time,omitempty"` 169 EndTime *time.Time `json:"end_time,omitempty"` 170 ParkingName *string `json:"parking_name,omitempty"` 171 ChargingDuration *int64 `json:"charging_duration,omitempty"` 172 DeviceId *string `json:"device_id,omitempty"` 173} 174 175type Payer struct { 176 Openid *string `json:"openid,omitempty"` 177} 178 179type QueryOrderAmount struct { 180 Total *int64 `json:"total,omitempty"` 181 Currency *string `json:"currency,omitempty"` 182 PayerTotal *int64 `json:"payer_total,omitempty"` 183 DiscountTotal *int64 `json:"discount_total,omitempty"` 184} 185 186type PromotionDetail struct { 187 CouponId *string `json:"coupon_id,omitempty"` 188 Name *string `json:"name,omitempty"` 189 Scope *string `json:"scope,omitempty"` 190 Type *string `json:"type,omitempty"` 191 StockId *string `json:"stock_id,omitempty"` 192 Amount *int64 `json:"amount,omitempty"` 193 WechatpayContribute *int64 `json:"wechatpay_contribute,omitempty"` 194 MerchantContribute *int64 `json:"merchant_contribute,omitempty"` 195 OtherContribute *int64 `json:"other_contribute,omitempty"` 196 Currency *string `json:"currency,omitempty"` 197} 198 199type PlateColor string 200 201func (e PlateColor) Ptr() *PlateColor { 202 return &e 203} 204 205const ( 206 PLATECOLOR_BLUE PlateColor = "BLUE" 207 PLATECOLOR_GREEN PlateColor = "GREEN" 208 PLATECOLOR_YELLOW PlateColor = "YELLOW" 209 PLATECOLOR_BLACK PlateColor = "BLACK" 210 PLATECOLOR_WHITE PlateColor = "WHITE" 211 PLATECOLOR_LIMEGREEN PlateColor = "LIMEGREEN" 212) 213
应答参数
|
appid 必填 string(32)
【公众账号ID】AppID是商户在微信申请公众号或移动应用成功后分配的账号ID,登录平台为mp.weixin.qq.com或open.weixin.qq.com
sp_mchid 必填 string(32)
【商户号】微信支付分配的商户号
description 必填 string(128)
【服务描述】商户自定义字段,用于交易账单中对扣费服务的描述。
create_time 必填 string(32)
【订单创建时间】订单成功创建时返回,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
out_trade_no 必填 string(32)
【商户订单号】商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
transaction_id 选填 string(32)
【微信支付订单号】微信支付订单号
trade_state 必填 string(32)
【交易状态】SUCCESS—支付成功
ACCEPTED—已接收,等待扣款
PAY_FAIL–支付失败(其他原因,如银行返回失败)
REFUND—转入退款
trade_state_description 选填 string(256)
【交易状态描述】对当前订单状态的描述和下一步操作的指引
success_time 选填 string(32)
【支付完成时间】订单支付完成时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
bank_type 选填 string(16)
【付款银行】银行类型,采用字符串类型的银行标识。BPA:该笔订单由微信进行垫付
user_repaid 选填 string(1)
【用户是否已还款】枚举值:
Y:用户已还款
N:用户未还款
注意:使用此字段前需先确认bank_type字段值为BPA以及 trade_state字段值为SUCCESS。
attach 选填 string(128)
【附加数据】附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
trade_scene 必填 string(32)
【交易场景】交易场景值,目前支持 :PARKING:车场停车场景
parking_info 选填 object
【停车场景信息】返回信息中的trade_scene为PARKING,返回该场景信息
属性 | |
parking_id 必填 string(32) 【入场ID】微信支付分停车服务为商户分配的入场ID,商户通过入场通知接口获取入场ID plate_number 必填 string(32) 【车牌号】车牌号,仅包括省份+车牌,不包括特殊字符。 plate_color 必填 string 【车牌颜色】车牌颜色 可选取值:
start_time 必填 string(32) 【入场时间】用户入场时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 end_time 必填 string(32) 【出场时间】用户出场时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 parking_name 必填 string(32) 【停车场名称】所在停车位车场的名称 charging_duration 必填 integer 【计费时长】计费的时间长,单位为秒 device_id 必填 string(32) 【停车场设备ID】停车场设备ID |
payer 必填 object
【支付者信息】支付者信息
属性 | |
openid 必填 string(32) 【用户在AppID下的标识】 用户在AppID下的唯一标识 |
amount 必填 object
【订单金额信息】订单金额信息
属性 | |
total 必填 integer 【订单金额】订单总金额,单位为分,只能为整数,详见支付金额 currency 必填 string(16) 【货币类型】符合ISO 4217标准的三位字母代码,目前只支持人民币:CNY payer_total 选填 integer 【用户实际支付金额】用户实际支付金额,单位为分,只能为整数,详见支付金额 discount_total 选填 integer 【折扣】订单折扣 |
promotion_detail 选填 array[object]
【优惠信息】优惠信息
属性 | |
coupon_id 必填 string(32) 【券ID】券或者立减优惠ID name 选填 string(128) 【优惠名称】优惠名称 scope 选填 string(32) 【优惠范围】GLOBAL-全场代金券, type 选填 string(16) 【优惠类型】枚举值: stock_id 选填 string(32) 【活动ID】在微信商户后台配置的批次ID amount 必填 integer 【优惠券面额】用户享受优惠的金额 wechatpay_contribute 选填 integer 【微信出资】特指由微信支付商户平台创建的优惠,出资金额等于本项优惠总金额,单位为分 merchant_contribute 选填 integer 【商户出资】特指商户自己创建的优惠,出资金额等于本项优惠总金额,单位为分 other_contribute 选填 integer 【其他出资】其他出资方出资金额,单位为分 currency 选填 string(16) 【优惠币种】CNY:人民币,境内商户号仅支持人民币。 |
应答示例
200 OK
1{ 2 "appid" : "wxcbda96de0b165486", 3 "sp_mchid" : "1230000109", 4 "description" : "停车场扣费", 5 "create_time" : "2017-08-26T10:43:39+08:00", 6 "out_trade_no" : "20150806125346", 7 "transaction_id" : "1009660380201506130728806387", 8 "trade_state" : "SUCCESS", 9 "trade_state_description" : "支付失败,请重新下单支付", 10 "success_time" : "2017-08-26T10:43:39+08:00", 11 "bank_type" : "CMC", 12 "user_repaid" : "Y", 13 "attach" : "深圳分店", 14 "trade_scene" : "PARKING", 15 "parking_info" : { 16 "parking_id" : "5K8264ILTKCH16CQ250", 17 "plate_number" : "粤B888888", 18 "plate_color" : "BLUE", 19 "start_time" : "2017-08-26T10:43:39+08:00", 20 "end_time" : "2017-08-26T10:43:39+08:00", 21 "parking_name" : "欢乐海岸停车场", 22 "charging_duration" : 3600, 23 "device_id" : "12313" 24 }, 25 "payer" : { 26 "openid" : "oUpF8uMuAJOM2pxb1Q" 27 }, 28 "amount" : { 29 "total" : 888, 30 "currency" : "CNY", 31 "payer_total" : 100, 32 "discount_total" : 100 33 }, 34 "promotion_detail" : [ 35 { 36 "coupon_id" : "109519", 37 "name" : "单品惠-6", 38 "scope" : "SINGLE", 39 "type" : "CASH", 40 "stock_id" : "931386", 41 "amount" : 5, 42 "wechatpay_contribute" : 1, 43 "merchant_contribute" : 1, 44 "other_contribute" : 1, 45 "currency" : "CNY" 46 } 47 ] 48} 49
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |
业务错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | ALREADY_EXISTS | out_trade_no冲突 | out_trade_no冲突,不同的订单请保证 out_trade_no 唯一 |
400 | INVALID_REQUEST | 非法商户,服务商模式下请确认子商户正确 | 微信支付分停车服务不支持当前商户访问,请确认商户已获得本产品权限。服务商模式下请同时确认子商户无误且已获得本产品权限 |
400 | INVALID_REQUEST | 商户号和公众号没有绑定关系 | 检查请求中的AppID与商户号(服务商模式下则为服务商商户号)是否匹配,然后重试 |
400 | INVALID_REQUEST | 商户号、子商户号以及子公众号没有绑定关系 | 检查请求中的 |
400 | INVALID_REQUEST | 用户状态异常 | 风控失败或者用户账户冻结 |
400 | INVALID_REQUEST | 停车入场ID不存在 | 商户传参的停车入场ID是非法,请填写微信支付分停车服务分配的停车入场ID |
400 | INVALID_REQUEST | 场景信息和停车入场ID不匹配 | 场景信息内容与入场ID不对应 |
400 | INVALID_REQUEST | 扣款额度超出限制 | 请检查确保发起扣款的订单额度不超过微信支付分停车支持的单笔及单日扣款额度 |
403 | NO_AUTH | 当前商户无法扣款 | 当前扣款商户无权限扣款,请确认当前扣款商户已开通微信支付分停车产品权限 |
403 | NOT_ENOUGH | 用户欠款过多,暂停交易 | 用户在微信支付分停车服务中欠款过多,不能进行扣款 |
403 | RULE_LIMIT | 超出扣费次数限制 | 请检查确保发起扣款的订单次数不超过微信支付分停车支持的单日扣款次数 |
429 | RATELIMIT_EXCEEDED | 达到调用速率限制 | 接口调用频率过快,请降低请求频率 |
500 | SYSTEM_ERROR | 出现内部服务器错误 | 5开头的错误码均为系统错误,请使用相同的参数稍后重试 |