微信支付订单号查询订单
更新时间:2025.01.16订单支付成功后,服务商可通过微信交易订单号或使用商户订单号查询订单;若订单未支付,则只能使用商户订单号查询订单。
接口说明
支持商户:【普通服务商】【平台商户】
请求方式:【GET】/v3/pay/partner/transactions/id/{transaction_id}
请求域名:【主域名】https://api.mch.weixin.qq.com 使用该域名将访问就近的接入点
【备域名】https://api2.mch.weixin.qq.com 使用该域名将访问异地的接入点 ,指引点击查看
请求参数
Header HTTP头参数
Authorization 必填 string
请参考签名认证生成认证信息
Accept 必填 string
请设置为application/json
path 路径参数
transaction_id 必填 string(32)
【微信支付订单号】 微信支付侧订单的唯一标识,订单支付成功后,支付成功回调通知和商户订单号查询订单会返回该参数。
query 查询参数
sp_mchid 必填 string(32)
【服务商商户号】服务商下单时传入的服务商商户号sp_mchid。
sub_mchid 必填 string(32)
【子商户号(也叫特约商户号)】服务商下单时传入的子商户号sub_mchid。
请求示例
GET
1curl -X GET \ 2 https://api.mch.weixin.qq.com/v3/pay/partner/transactions/id/1217752501201407033233368018?sp_mchid=1230000109&sub_mchid=1900000109 \ 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 PartnerQueryByWxTradeNo { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "GET"; 28 private static String PATH = "/v3/pay/partner/transactions/id/{transaction_id}"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 PartnerQueryByWxTradeNo client = new PartnerQueryByWxTradeNo( 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 PartnerQueryByWxTradeNoRequest request = new PartnerQueryByWxTradeNoRequest(); 41 request.transactionId = "1217752501201407033233368018"; 42 request.spMchid = "1230000109"; 43 request.subMchid = "1900000109"; 44 try { 45 PartnerAPIv3PartnerQueryResponse response = client.run(request); 46 // TODO: 请求成功,继续业务逻辑 47 System.out.println(response); 48 } catch (WXPayUtility.ApiException e) { 49 // TODO: 请求失败,根据状态码执行不同的逻辑 50 e.printStackTrace(); 51 } 52 } 53 54 public PartnerAPIv3PartnerQueryResponse run(PartnerQueryByWxTradeNoRequest request) { 55 String uri = PATH; 56 uri = uri.replace("{transaction_id}", WXPayUtility.urlEncode(request.transactionId)); 57 Map<String, Object> args = new HashMap<>(); 58 args.put("sp_mchid", request.spMchid); 59 args.put("sub_mchid", request.subMchid); 60 String queryString = WXPayUtility.urlEncode(args); 61 if (!queryString.isEmpty()) { 62 uri = uri + "?" + queryString; 63 } 64 65 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 66 reqBuilder.addHeader("Accept", "application/json"); 67 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 68 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 69 reqBuilder.method(METHOD, null); 70 Request httpRequest = reqBuilder.build(); 71 72 // 发送HTTP请求 73 OkHttpClient client = new OkHttpClient.Builder().build(); 74 try (Response httpResponse = client.newCall(httpRequest).execute()) { 75 String respBody = WXPayUtility.extractBody(httpResponse); 76 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 77 // 2XX 成功,验证应答签名 78 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 79 httpResponse.headers(), respBody); 80 81 // 从HTTP应答报文构建返回数据 82 return WXPayUtility.fromJson(respBody, PartnerAPIv3PartnerQueryResponse.class); 83 } else { 84 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 85 } 86 } catch (IOException e) { 87 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 88 } 89 } 90 91 private final String mchid; 92 private final String certificateSerialNo; 93 private final PrivateKey privateKey; 94 private final String wechatPayPublicKeyId; 95 private final PublicKey wechatPayPublicKey; 96 97 public PartnerQueryByWxTradeNo(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 98 this.mchid = mchid; 99 this.certificateSerialNo = certificateSerialNo; 100 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 101 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 102 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 103 } 104 105 public static class PartnerQueryByWxTradeNoRequest { 106 @SerializedName("sp_mchid") 107 @Expose(serialize = false) 108 public String spMchid; 109 110 @SerializedName("sub_mchid") 111 @Expose(serialize = false) 112 public String subMchid; 113 114 @SerializedName("transaction_id") 115 @Expose(serialize = false) 116 public String transactionId; 117 } 118 119 public static class PartnerAPIv3PartnerQueryResponse { 120 @SerializedName("sp_appid") 121 public String spAppid; 122 123 @SerializedName("sp_mchid") 124 public String spMchid; 125 126 @SerializedName("sub_appid") 127 public String subAppid; 128 129 @SerializedName("sub_mchid") 130 public String subMchid; 131 132 @SerializedName("out_trade_no") 133 public String outTradeNo; 134 135 @SerializedName("transaction_id") 136 public String transactionId; 137 138 @SerializedName("trade_type") 139 public String tradeType; 140 141 @SerializedName("trade_state") 142 public String tradeState; 143 144 @SerializedName("trade_state_desc") 145 public String tradeStateDesc; 146 147 @SerializedName("bank_type") 148 public String bankType; 149 150 @SerializedName("attach") 151 public String attach; 152 153 @SerializedName("success_time") 154 public String successTime; 155 156 @SerializedName("payer") 157 public PartnerCommRespPayerInfo payer; 158 159 @SerializedName("amount") 160 public CommRespAmountInfo amount; 161 162 @SerializedName("scene_info") 163 public CommRespSceneInfo sceneInfo; 164 165 @SerializedName("promotion_detail") 166 public List<PromotionDetail> promotionDetail; 167 } 168 169 public static class PartnerCommRespPayerInfo { 170 @SerializedName("sp_openid") 171 public String spOpenid; 172 173 @SerializedName("sub_openid") 174 public String subOpenid; 175 } 176 177 public static class CommRespAmountInfo { 178 @SerializedName("total") 179 public Long total; 180 181 @SerializedName("payer_total") 182 public Long payerTotal; 183 184 @SerializedName("currency") 185 public String currency; 186 187 @SerializedName("payer_currency") 188 public String payerCurrency; 189 } 190 191 public static class CommRespSceneInfo { 192 @SerializedName("device_id") 193 public String deviceId; 194 } 195 196 public static class PromotionDetail { 197 @SerializedName("coupon_id") 198 public String couponId; 199 200 @SerializedName("name") 201 public String name; 202 203 @SerializedName("scope") 204 public String scope; 205 206 @SerializedName("type") 207 public String type; 208 209 @SerializedName("amount") 210 public Long amount; 211 212 @SerializedName("stock_id") 213 public String stockId; 214 215 @SerializedName("wechatpay_contribute") 216 public Long wechatpayContribute; 217 218 @SerializedName("merchant_contribute") 219 public Long merchantContribute; 220 221 @SerializedName("other_contribute") 222 public Long otherContribute; 223 224 @SerializedName("currency") 225 public String currency; 226 227 @SerializedName("goods_detail") 228 public List<GoodsDetailInPromotion> goodsDetail; 229 } 230 231 public static class GoodsDetailInPromotion { 232 @SerializedName("goods_id") 233 public String goodsId; 234 235 @SerializedName("quantity") 236 public Long quantity; 237 238 @SerializedName("unit_price") 239 public Long unitPrice; 240 241 @SerializedName("discount_amount") 242 public Long discountAmount; 243 244 @SerializedName("goods_remark") 245 public String goodsRemark; 246 } 247 248} 249
需配合微信支付工具库 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 := &PartnerQueryByWxTradeNoRequest{ 27 SpMchid: wxpay_utility.String("1230000109"), 28 SubMchid: wxpay_utility.String("1900000109"), 29 TransactionId: wxpay_utility.String("1217752501201407033233368018"), 30 } 31 32 response, err := PartnerQueryByWxTradeNo(config, request) 33 if err != nil { 34 fmt.Printf("请求失败: %+v\n", err) 35 // TODO: 请求失败,根据状态码执行不同的处理 36 return 37 } 38 39 // TODO: 请求成功,继续业务逻辑 40 fmt.Printf("请求成功: %+v\n", response) 41} 42 43func PartnerQueryByWxTradeNo(config *wxpay_utility.MchConfig, request *PartnerQueryByWxTradeNoRequest) (response *PartnerApiv3PartnerQueryResponse, err error) { 44 const ( 45 host = "https://api.mch.weixin.qq.com" 46 method = "GET" 47 path = "/v3/pay/partner/transactions/id/{transaction_id}" 48 ) 49 50 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 51 if err != nil { 52 return nil, err 53 } 54 reqUrl.Path = strings.Replace(reqUrl.Path, "{transaction_id}", url.PathEscape(*request.TransactionId), -1) 55 query := reqUrl.Query() 56 if request.SpMchid != nil { 57 query.Add("sp_mchid", *request.SpMchid) 58 } 59 if request.SubMchid != nil { 60 query.Add("sub_mchid", *request.SubMchid) 61 } 62 reqUrl.RawQuery = query.Encode() 63 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 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 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 70 if err != nil { 71 return nil, err 72 } 73 httpRequest.Header.Set("Authorization", authorization) 74 75 client := &http.Client{} 76 httpResponse, err := client.Do(httpRequest) 77 if err != nil { 78 return nil, err 79 } 80 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 81 if err != nil { 82 return nil, err 83 } 84 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 85 // 2XX 成功,验证应答签名 86 err = wxpay_utility.ValidateResponse( 87 config.WechatPayPublicKeyId(), 88 config.WechatPayPublicKey(), 89 &httpResponse.Header, 90 respBody, 91 ) 92 if err != nil { 93 return nil, err 94 } 95 response := &PartnerApiv3PartnerQueryResponse{} 96 if err := json.Unmarshal(respBody, response); err != nil { 97 return nil, err 98 } 99 100 return response, nil 101 } else { 102 return nil, wxpay_utility.NewApiException( 103 httpResponse.StatusCode, 104 httpResponse.Header, 105 respBody, 106 ) 107 } 108} 109 110type PartnerQueryByWxTradeNoRequest struct { 111 SpMchid *string `json:"sp_mchid,omitempty"` 112 SubMchid *string `json:"sub_mchid,omitempty"` 113 TransactionId *string `json:"transaction_id,omitempty"` 114} 115 116func (o *PartnerQueryByWxTradeNoRequest) MarshalJSON() ([]byte, error) { 117 type Alias PartnerQueryByWxTradeNoRequest 118 a := &struct { 119 SpMchid *string `json:"sp_mchid,omitempty"` 120 SubMchid *string `json:"sub_mchid,omitempty"` 121 TransactionId *string `json:"transaction_id,omitempty"` 122 *Alias 123 }{ 124 // 序列化时移除非 Body 字段 125 SpMchid: nil, 126 SubMchid: nil, 127 TransactionId: nil, 128 Alias: (*Alias)(o), 129 } 130 return json.Marshal(a) 131} 132 133type PartnerApiv3PartnerQueryResponse struct { 134 SpAppid *string `json:"sp_appid,omitempty"` 135 SpMchid *string `json:"sp_mchid,omitempty"` 136 SubAppid *string `json:"sub_appid,omitempty"` 137 SubMchid *string `json:"sub_mchid,omitempty"` 138 OutTradeNo *string `json:"out_trade_no,omitempty"` 139 TransactionId *string `json:"transaction_id,omitempty"` 140 TradeType *string `json:"trade_type,omitempty"` 141 TradeState *string `json:"trade_state,omitempty"` 142 TradeStateDesc *string `json:"trade_state_desc,omitempty"` 143 BankType *string `json:"bank_type,omitempty"` 144 Attach *string `json:"attach,omitempty"` 145 SuccessTime *string `json:"success_time,omitempty"` 146 Payer *PartnerCommRespPayerInfo `json:"payer,omitempty"` 147 Amount *CommRespAmountInfo `json:"amount,omitempty"` 148 SceneInfo *CommRespSceneInfo `json:"scene_info,omitempty"` 149 PromotionDetail []PromotionDetail `json:"promotion_detail,omitempty"` 150} 151 152type PartnerCommRespPayerInfo struct { 153 SpOpenid *string `json:"sp_openid,omitempty"` 154 SubOpenid *string `json:"sub_openid,omitempty"` 155} 156 157type CommRespAmountInfo struct { 158 Total *int64 `json:"total,omitempty"` 159 PayerTotal *int64 `json:"payer_total,omitempty"` 160 Currency *string `json:"currency,omitempty"` 161 PayerCurrency *string `json:"payer_currency,omitempty"` 162} 163 164type CommRespSceneInfo struct { 165 DeviceId *string `json:"device_id,omitempty"` 166} 167 168type PromotionDetail struct { 169 CouponId *string `json:"coupon_id,omitempty"` 170 Name *string `json:"name,omitempty"` 171 Scope *string `json:"scope,omitempty"` 172 Type *string `json:"type,omitempty"` 173 Amount *int64 `json:"amount,omitempty"` 174 StockId *string `json:"stock_id,omitempty"` 175 WechatpayContribute *int64 `json:"wechatpay_contribute,omitempty"` 176 MerchantContribute *int64 `json:"merchant_contribute,omitempty"` 177 OtherContribute *int64 `json:"other_contribute,omitempty"` 178 Currency *string `json:"currency,omitempty"` 179 GoodsDetail []GoodsDetailInPromotion `json:"goods_detail,omitempty"` 180} 181 182type GoodsDetailInPromotion struct { 183 GoodsId *string `json:"goods_id,omitempty"` 184 Quantity *int64 `json:"quantity,omitempty"` 185 UnitPrice *int64 `json:"unit_price,omitempty"` 186 DiscountAmount *int64 `json:"discount_amount,omitempty"` 187 GoodsRemark *string `json:"goods_remark,omitempty"` 188} 189
应答参数
|
sp_appid 必填 string(32)
【服务商APPID】服务商下单时传入的服务商sp_appid。
sp_mchid 必填 string(32)
【服务商商户号】服务商下单时传入的服务商商户号sp_mchid。
sub_appid 选填 string(32)
【子商户APPID】服务商下单时传入的子商户sub_appid,若下单未传该参数,则不会返回。
sub_mchid 必填 string(32)
【子商户号】服务商下单时传入的子商户号sub_mchid。
out_trade_no 必填 string(32)
【商户订单号】 服务商下单时传入的服务商系统内部订单号。
transaction_id 必填 string(32)
【微信支付订单号】 微信支付侧订单的唯一标识。
trade_type 必填 string(16)
【交易类型】 返回当前订单的交易类型,枚举值:
JSAPI:公众号支付、小程序支付
NATIVE:Native支付
APP:APP支付
MICROPAY:付款码支付
MWEB:H5支付
FACEPAY:刷脸支付
trade_state 必填 string(32)
【交易状态】 返回订单当前交易状态。详细业务流转状态处理请参考开发指引-订单状态流转图。枚举值:
SUCCESS:支付成功
REFUND:转入退款
NOTPAY:未支付
CLOSED:已关闭
REVOKED:已撤销(仅付款码支付会返回)
USERPAYING:用户支付中(仅付款码支付会返回)
PAYERROR:支付失败(仅付款码支付会返回)
trade_state_desc 必填 string(256)
【交易状态描述】 对交易状态的详细说明。
bank_type 选填 string(32)
【银行类型】 用户支付方式,订单支付成功后返回,
1、使用银行卡支付,例如工商银行借记卡,该字段返回 ICBC_DEBIT
,更多银行类型请参考《银行类型对照表》。
2、使用非银行卡支付,例如余额/零钱通等,该字段统一返回OTHERS
。
attach 选填 string(128)
success_time 选填 string(64)
【支付完成时间】
1、定义:用户完成订单支付的时间。该参数在订单支付成功后返回。
2、格式:遵循rfc3339标准格式:yyyy-MM-DDTHH:mm:ss+TIMEZONE。yyyy-MM-DD 表示年月日;T 字符用于分隔日期和时间部分;HH:mm:ss 表示具体的时分秒;TIMEZONE 表示时区(例如,+08:00 对应东八区时间,即北京时间)。
示例:2015-05-20T13:29:35+08:00 表示北京时间2015年5月20日13点29分35秒。
payer 选填 object
【支付者信息】 支付者信息。
属性 | |
sp_openid 选填 string(128) 【用户服务商标识】用户在服务商sp_appid下唯一标识。 sub_openid 选填 string(128) 【用户子商户标识】 用户在子商户sub_appid下唯一标识,若下单未传sub_appid参数,则不会返回。 |
amount 选填 object
【订单金额】 订单金额信息。
属性 | |
total 选填 integer 【总金额】 订单总金额,单位为分,整型。 payer_total 选填 integer 【用户支付金额】用户实际支付金额,整型,单位为分,用户支付金额=总金额-代金券金额。 currency 选填 string(16) 【货币类型】固定返回:CNY,代表人民币。 payer_currency 选填 string(16) 【用户支付币种】 固定返回:CNY,代表人民币。 |
scene_info 选填 object
【场景信息】 下单时传入的支付场景描述,若下单传入该参数,则原样返回;若下单未传该参数,则不会返回。
属性 | |
device_id 必填 string(32) 【商户端设备号】 商户下单时传入的商户端设备号(门店号或收银设备ID)。 |
promotion_detail 选填 array[object]
【优惠功能】 代金券信息,当订单有使用代金券时,该字段将返回所使用的代金券信息。
属性 | |||||
coupon_id 必填 string(32) 【券ID】 代金券id,微信为代金券分配的唯一标识,创券商户调用发放指定批次的代金券时返回的代金券ID coupon_id。 name 必填 string(64) 【优惠名称】 优惠名称,创券商户创建代金券批次时传入的批次名称stock_name。 scope 选填 string(32) 【优惠范围】优惠活动中代金券的适用范围,分为两种类型: type 选填 string(32) 【优惠类型】代金券资金类型,优惠活动中代金券的结算资金类型,分为两种类型: amount 必填 integer 【优惠券面额】代金券优惠的金额。 stock_id 选填 string(32) 【活动ID】单张代金券所对应的批次号。 wechatpay_contribute 选填 integer 【微信出资】 代金券有三种出资类型:微信出资、商户出资和其他出资。本参数将返回选择“微信出资类型”时的优惠券面额。 merchant_contribute 选填 integer 【商户出资】代金券有三种出资类型:微信出资、商户出资和其他出资。本参数将返回选择“商户出资类型”时的优惠券面额。 other_contribute 选填 integer 【其他出资】代金券有三种出资类型:微信出资、商户出资和其他出资。本参数将返回选择“其他出资类型”时的优惠券面额。 currency 选填 string(16) 【优惠币种】 代金券金额所对应的货币种类:固定返回:CNY,人民币。 goods_detail 选填 array[object] 【单品列表】 单品列表。scope为SINGLE(单品优惠)时返回该参数
|
应答示例
200 OK
1{ 2 "sp_appid" : "wx8888888888888888", 3 "sp_mchid" : "1230000109", 4 "sub_appid" : "wxd678efh567hg6999", 5 "sub_mchid" : "1900000109", 6 "out_trade_no" : "1217752501201407033233368018", 7 "transaction_id" : "1217752501201407033233368018", 8 "trade_type" : "MICROPAY", 9 "trade_state" : "SUCCESS", 10 "trade_state_desc" : "支付失败,请重新下单支付", 11 "bank_type" : "CMC", 12 "attach" : "自定义数据", 13 "success_time" : "2018-06-08T10:34:56+08:00", 14 "payer" : { 15 "sp_openid" : "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o\t", 16 "sub_openid" : "example_sub_openid" 17 }, 18 "amount" : { 19 "total" : 100, 20 "payer_total" : 100, 21 "currency" : "CNY", 22 "payer_currency" : "CNY" 23 }, 24 "scene_info" : { 25 "device_id" : "013467007045764" 26 }, 27 "promotion_detail" : [ 28 { 29 "coupon_id" : "109519", 30 "name" : "单品惠-6", 31 "scope" : "GLOBAL", 32 "type" : "CASH", 33 "amount" : 100, 34 "stock_id" : "931386", 35 "wechatpay_contribute" : 0, 36 "merchant_contribute" : 0, 37 "other_contribute" : 0, 38 "currency" : "CNY", 39 "goods_detail" : [ 40 { 41 "goods_id" : "M1006", 42 "quantity" : 1, 43 "unit_price" : 100, 44 "discount_amount" : 1, 45 "goods_remark" : "商品备注信息" 46 } 47 ] 48 } 49 ] 50} 51
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |
业务错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | INVALID_REQUEST | 无效请求 | 请根据接口返回的详细信息检查 |
400 | MCH_NOT_EXISTS | 商户号不存在 | 请检查商户号是否正确,商户号获取方式请参考服务商模式开发必要参数说明 |
401 | SIGN_ERROR | 签名错误 | 请检查签名参数和方法是否都符合签名算法要求,参考:如何生成签名 |
403 | RULE_LIMIT | 业务规则限制 | 因业务规则限制请求频率,请查看接口返回的详细信息 |
403 | TRADE_ERROR | 交易错误 | 因业务原因交易失败,请查看接口返回的详细信息 |
404 | ORDER_NOT_EXIST | 订单不存在 | 请检查传入的微信支付订单号是否正确 |
429 | FREQUENCY_LIMITED | 频率超限 | 请降低请求接口频率 |
500 | SYSTEM_ERROR | 系统错误 | 系统异常,请用相同参数重新调用 |