同步非临停扩展支付
更新时间:2026.06.29对商户提供非临停扩展支付数据同步接口(仅落库,不参与临停停车单)。适用对象与普通服务商一致,支持普通商户、普通服务商、平台商户(电商模式),与既有停车提醒 API 相同。
接口说明
支持商户:【普通服务商】 【平台商户】
请求方式:【POST】/v3/parking/reminders/ext-payment
请求域名:【主域名】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 包体参数
out_trade_no 必填 string(64)
【商户支付订单号】 商户侧支付订单号;建议与 wx_trade_no 一并传入。长度1~64字符,同一商户号下建议唯一。
fee_items 必填 array[object]
【费用明细】 费用明细列表;至少一条;多条时表示同一外部支付单覆盖多种费用类型及各自金额
| 属性 | |
fee_type 必填 string 【费用类型】 月卡/季卡/会员等;预留枚举未开放时由服务端拒绝。 可选取值
amount 必填 integer 【金额】 该费用类型对应金额,单位为分 |
pay_time 必填 integer
【支付时间】 支付完成时刻,秒级时间戳(Unix timestamp)。例如:1719128975 表示北京时间2024-06-23 13:29:35。
wx_parking_lot_id 选填 string(64)
【微信停车场ID】 停车场进件审核通过且运营入驻完成后,由微信支付分配。可通过「查询停车场进件申请单」或「查询停车场信息」接口获取;入场/离场/支付等接口须与入场时保持一致。无具体停车场时可不填。
wx_trade_no 选填 string(64)
【微信支付订单号】 微信支付订单号;建议与 out_trade_no 一并传入。长度1~64字符。
请求示例
POST
1curl -X POST \ 2 https://api.mch.weixin.qq.com/v3/parking/reminders/ext-payment \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" \ 5 -H "Content-Type: application/json" \ 6 -d '{ 7 "out_trade_no" : "4200001234567890123456789012", 8 "fee_items" : [ 9 { 10 "fee_type" : "EXT_PARKING_PAYMENT_FEE_TYPE_UNKNOWN", 11 "amount" : 1 12 } 13 ], 14 "pay_time" : 1, 15 "wx_parking_lot_id" : "21232735744117624001123604298240", 16 "wx_trade_no" : "4200001234567890123456789012" 17 }' 18
需配合微信支付工具库 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 SyncParkingExtPayment { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "POST"; 28 private static String PATH = "/v3/parking/reminders/ext-payment"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 SyncParkingExtPayment client = new SyncParkingExtPayment( 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 SyncParkingExtPaymentRequest request = new SyncParkingExtPaymentRequest(); 41 request.outTradeNo = "4200001234567890123456789012"; 42 request.feeItems = new ArrayList<>(); 43 { 44 ExtParkingPaymentFeeItem feeItemsItem = new ExtParkingPaymentFeeItem(); 45 feeItemsItem.feeType = ExtParkingPaymentFeeType.EXT_PARKING_PAYMENT_FEE_TYPE_UNKNOWN; 46 feeItemsItem.amount = 1L; 47 request.feeItems.add(feeItemsItem); 48 }; 49 request.payTime = 1L; 50 request.wxParkingLotId = "21232735744117624001123604298240"; 51 request.wxTradeNo = "4200001234567890123456789012"; 52 try { 53 SyncParkingExtPaymentResponse response = client.run(request); 54 // TODO: 请求成功,继续业务逻辑 55 System.out.println(response); 56 } catch (WXPayUtility.ApiException e) { 57 // TODO: 请求失败,根据状态码执行不同的逻辑 58 e.printStackTrace(); 59 } 60 } 61 62 public SyncParkingExtPaymentResponse run(SyncParkingExtPaymentRequest request) { 63 String uri = PATH; 64 String reqBody = WXPayUtility.toJson(request); 65 66 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 67 reqBuilder.addHeader("Accept", "application/json"); 68 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 69 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 70 reqBuilder.addHeader("Content-Type", "application/json"); 71 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 72 reqBuilder.method(METHOD, requestBody); 73 Request httpRequest = reqBuilder.build(); 74 75 // 发送HTTP请求 76 OkHttpClient client = new OkHttpClient.Builder().build(); 77 try (Response httpResponse = client.newCall(httpRequest).execute()) { 78 String respBody = WXPayUtility.extractBody(httpResponse); 79 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 80 // 2XX 成功,验证应答签名 81 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 82 httpResponse.headers(), respBody); 83 84 // 从HTTP应答报文构建返回数据 85 return WXPayUtility.fromJson(respBody, SyncParkingExtPaymentResponse.class); 86 } else { 87 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 88 } 89 } catch (IOException e) { 90 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 91 } 92 } 93 94 private final String mchid; 95 private final String certificateSerialNo; 96 private final PrivateKey privateKey; 97 private final String wechatPayPublicKeyId; 98 private final PublicKey wechatPayPublicKey; 99 100 public SyncParkingExtPayment(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 101 this.mchid = mchid; 102 this.certificateSerialNo = certificateSerialNo; 103 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 104 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 105 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 106 } 107 108 public static class SyncParkingExtPaymentRequest { 109 @SerializedName("out_trade_no") 110 public String outTradeNo; 111 112 @SerializedName("fee_items") 113 public List<ExtParkingPaymentFeeItem> feeItems = new ArrayList<ExtParkingPaymentFeeItem>(); 114 115 @SerializedName("pay_time") 116 public Long payTime; 117 118 @SerializedName("wx_parking_lot_id") 119 public String wxParkingLotId; 120 121 @SerializedName("wx_trade_no") 122 public String wxTradeNo; 123 } 124 125 public static class SyncParkingExtPaymentResponse { 126 @SerializedName("code") 127 public String code; 128 129 @SerializedName("message") 130 public String message; 131 } 132 133 public static class ExtParkingPaymentFeeItem { 134 @SerializedName("fee_type") 135 public ExtParkingPaymentFeeType feeType; 136 137 @SerializedName("amount") 138 public Long amount; 139 } 140 141 public enum ExtParkingPaymentFeeType { 142 @SerializedName("EXT_PARKING_PAYMENT_FEE_TYPE_UNKNOWN") 143 EXT_PARKING_PAYMENT_FEE_TYPE_UNKNOWN, 144 @SerializedName("EXT_PARKING_PAYMENT_FEE_TYPE_MONTHLY") 145 EXT_PARKING_PAYMENT_FEE_TYPE_MONTHLY, 146 @SerializedName("EXT_PARKING_PAYMENT_FEE_TYPE_QUARTERLY") 147 EXT_PARKING_PAYMENT_FEE_TYPE_QUARTERLY, 148 @SerializedName("EXT_PARKING_PAYMENT_FEE_TYPE_MEMBER") 149 EXT_PARKING_PAYMENT_FEE_TYPE_MEMBER 150 } 151 152} 153
需配合微信支付工具库 wxpay_utility 使用,请参考Go
1package main 2 3import ( 4 "bytes" 5 "demo/wxpay_utility" // 引用微信支付工具库,参考 https://pay.weixin.qq.com/doc/v3/partner/4015119446 6 "encoding/json" 7 "fmt" 8 "net/http" 9 "net/url" 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 := &SyncParkingExtPaymentRequest{ 27 OutTradeNo: wxpay_utility.String("4200001234567890123456789012"), 28 FeeItems: []ExtParkingPaymentFeeItem{ExtParkingPaymentFeeItem{ 29 FeeType: EXTPARKINGPAYMENTFEETYPE_EXT_PARKING_PAYMENT_FEE_TYPE_UNKNOWN.Ptr(), 30 Amount: wxpay_utility.Int64(1), 31 }}, 32 PayTime: wxpay_utility.Int64(1), 33 WxParkingLotId: wxpay_utility.String("21232735744117624001123604298240"), 34 WxTradeNo: wxpay_utility.String("4200001234567890123456789012"), 35 } 36 37 response, err := SyncParkingExtPayment(config, request) 38 if err != nil { 39 fmt.Printf("请求失败: %+v\n", err) 40 // TODO: 请求失败,根据状态码执行不同的处理 41 return 42 } 43 44 // TODO: 请求成功,继续业务逻辑 45 fmt.Printf("请求成功: %+v\n", response) 46} 47 48func SyncParkingExtPayment(config *wxpay_utility.MchConfig, request *SyncParkingExtPaymentRequest) (response *SyncParkingExtPaymentResponse, err error) { 49 const ( 50 host = "https://api.mch.weixin.qq.com" 51 method = "POST" 52 path = "/v3/parking/reminders/ext-payment" 53 ) 54 55 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 56 if err != nil { 57 return nil, err 58 } 59 reqBody, err := json.Marshal(request) 60 if err != nil { 61 return nil, err 62 } 63 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 64 if err != nil { 65 return nil, err 66 } 67 httpRequest.Header.Set("Accept", "application/json") 68 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 69 httpRequest.Header.Set("Content-Type", "application/json") 70 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody) 71 if err != nil { 72 return nil, err 73 } 74 httpRequest.Header.Set("Authorization", authorization) 75 76 client := &http.Client{} 77 httpResponse, err := client.Do(httpRequest) 78 if err != nil { 79 return nil, err 80 } 81 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 82 if err != nil { 83 return nil, err 84 } 85 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 86 // 2XX 成功,验证应答签名 87 err = wxpay_utility.ValidateResponse( 88 config.WechatPayPublicKeyId(), 89 config.WechatPayPublicKey(), 90 &httpResponse.Header, 91 respBody, 92 ) 93 if err != nil { 94 return nil, err 95 } 96 response := &SyncParkingExtPaymentResponse{} 97 if err := json.Unmarshal(respBody, response); err != nil { 98 return nil, err 99 } 100 101 return response, nil 102 } else { 103 return nil, wxpay_utility.NewApiException( 104 httpResponse.StatusCode, 105 httpResponse.Header, 106 respBody, 107 ) 108 } 109} 110 111type SyncParkingExtPaymentRequest struct { 112 OutTradeNo *string `json:"out_trade_no,omitempty"` 113 FeeItems []ExtParkingPaymentFeeItem `json:"fee_items,omitempty"` 114 PayTime *int64 `json:"pay_time,omitempty"` 115 WxParkingLotId *string `json:"wx_parking_lot_id,omitempty"` 116 WxTradeNo *string `json:"wx_trade_no,omitempty"` 117} 118 119type SyncParkingExtPaymentResponse struct { 120 Code *string `json:"code,omitempty"` 121 Message *string `json:"message,omitempty"` 122} 123 124type ExtParkingPaymentFeeItem struct { 125 FeeType *ExtParkingPaymentFeeType `json:"fee_type,omitempty"` 126 Amount *int64 `json:"amount,omitempty"` 127} 128 129type ExtParkingPaymentFeeType string 130 131func (e ExtParkingPaymentFeeType) Ptr() *ExtParkingPaymentFeeType { 132 return &e 133} 134 135const ( 136 EXTPARKINGPAYMENTFEETYPE_EXT_PARKING_PAYMENT_FEE_TYPE_UNKNOWN ExtParkingPaymentFeeType = "EXT_PARKING_PAYMENT_FEE_TYPE_UNKNOWN" 137 EXTPARKINGPAYMENTFEETYPE_EXT_PARKING_PAYMENT_FEE_TYPE_MONTHLY ExtParkingPaymentFeeType = "EXT_PARKING_PAYMENT_FEE_TYPE_MONTHLY" 138 EXTPARKINGPAYMENTFEETYPE_EXT_PARKING_PAYMENT_FEE_TYPE_QUARTERLY ExtParkingPaymentFeeType = "EXT_PARKING_PAYMENT_FEE_TYPE_QUARTERLY" 139 EXTPARKINGPAYMENTFEETYPE_EXT_PARKING_PAYMENT_FEE_TYPE_MEMBER ExtParkingPaymentFeeType = "EXT_PARKING_PAYMENT_FEE_TYPE_MEMBER" 140) 141
应答参数
200 OK
code 选填 string(32)
【响应码】 仅接口调用失败时返回;调用成功时不返回此字段。失败时返回错误码字符串,具体见接口错误码列表。
message 选填 string(256)
【返回信息】 仅接口调用失败时返回;调用成功时不返回此字段。失败时返回错误原因描述。
应答示例
200 OK
1{ 2 "code" : "PARAM_ERROR", 3 "message" : "参数错误" 4} 5
错误码
以下是本接口返回的错误码列表。详细错误码规则,请参考微信支付接口规则-错误码和错误提示
