微信支付订单号查询订单
更新时间: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。
请求示例
需配合微信支付工具库 WXPayUtility 使用,请参考 Java
1package com.java.demo; 2 3import com.google.gson.annotations.Expose; 4import com.google.gson.annotations.SerializedName; 5import com.java.utils.WXPayUtility; // 引用微信支付工具库 参考:https://pay.weixin.qq.com/doc/v3/partner/4014985777 6import java.io.IOException; 7import java.io.UncheckedIOException; 8import java.security.PrivateKey; 9import java.security.PublicKey; 10import java.util.ArrayList; 11import java.util.HashMap; 12import java.util.List; 13import java.util.Map; 14import okhttp3.MediaType; 15import okhttp3.OkHttpClient; 16import okhttp3.Request; 17import okhttp3.RequestBody; 18import okhttp3.Response; 19 20/** 21 * 微信支付订单号查询订单 22 */ 23public class PartnerQueryByWxTradeNo { 24 private static String HOST = "https://api.mch.weixin.qq.com"; 25 private static String METHOD = "GET"; 26 private static String PATH = "/v3/pay/partner/transactions/id/{transaction_id}"; 27 28 public static void main(String[] args) { 29 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/partner/4013080340 30 PartnerQueryByWxTradeNo client = new PartnerQueryByWxTradeNo( 31 "填入 商户号", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考https://pay.weixin.qq.com/doc/v3/partner/4013080340 32 "填入 商户API证书序列号", // 商户API证书序列号,如何获取请参考https://pay.weixin.qq.com/doc/v3/partner/4013058924 33 "填入 商户API证书私钥文件路径", // 商户API证书私钥文件路径,本地文件路径 34 "填入 微信支付公钥ID", // 微信支付公钥ID,如何获取请参考https://pay.weixin.qq.com/doc/v3/partner/4013038589 35 "填入 微信支付公钥文件路径" // 微信支付公钥文件路径,本地文件路径 36 ); 37 38 PartnerQueryByWxTradeNoRequest request = new PartnerQueryByWxTradeNoRequest(); 39 request.transactionId = "1217752501201407033233368018"; 40 request.spMchid = "1230000109"; 41 request.subMchid = "1900000109"; 42 try { 43 PartnerAPIv3PartnerQueryResponse response = client.run(request); 44 45 // TODO: 请求成功,继续业务逻辑 46 System.out.println(response); 47 } catch (WXPayUtility.ApiException e) { 48 // TODO: 请求失败,根据状态码执行不同的逻辑 49 e.printStackTrace(); 50 } 51 } 52 53 public PartnerAPIv3PartnerQueryResponse run(PartnerQueryByWxTradeNoRequest request) { 54 String uri = PATH; 55 uri = uri.replace("{transaction_id}", WXPayUtility.urlEncode(request.transactionId)); 56 Map<String, Object> args = new HashMap<>(); 57 args.put("sp_mchid", request.spMchid); 58 args.put("sub_mchid", request.subMchid); 59 uri = uri + "?" + WXPayUtility.urlEncode(args); 60 61 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 62 reqBuilder.addHeader("Accept", "application/json"); 63 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 64 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo, privateKey, METHOD, uri, null)); 65 reqBuilder.method(METHOD, null); 66 Request httpRequest = reqBuilder.build(); 67 68 // 发送HTTP请求 69 OkHttpClient client = new OkHttpClient.Builder().build(); 70 try (Response httpResponse = client.newCall(httpRequest).execute()) { 71 String respBody = WXPayUtility.extractBody(httpResponse); 72 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 73 // 2XX 成功,验证应答签名 74 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 75 httpResponse.headers(), respBody); 76 77 // 从HTTP应答报文构建返回数据 78 return WXPayUtility.fromJson(respBody, PartnerAPIv3PartnerQueryResponse.class); 79 } else { 80 throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); 81 } 82 } catch (IOException e) { 83 throw new UncheckedIOException("Sending request to " + uri + " failed.", e); 84 } 85 } 86 87 private final String mchid; 88 private final String certificateSerialNo; 89 private final PrivateKey privateKey; 90 private final String wechatPayPublicKeyId; 91 private final PublicKey wechatPayPublicKey; 92 93 public PartnerQueryByWxTradeNo(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { 94 this.mchid = mchid; 95 this.certificateSerialNo = certificateSerialNo; 96 this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); 97 this.wechatPayPublicKeyId = wechatPayPublicKeyId; 98 this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); 99 } 100 101 public static class CommRespAmountInfo { 102 @SerializedName("total") 103 public Long total; 104 105 @SerializedName("payer_total") 106 public Long payerTotal; 107 108 @SerializedName("currency") 109 public String currency; 110 111 @SerializedName("payer_currency") 112 public String payerCurrency; 113 } 114 115 public static class CommRespSceneInfo { 116 @SerializedName("device_id") 117 public String deviceId; 118 119 @SerializedName("store_info") 120 public StoreInfo storeInfo; 121 } 122 123 public static class PartnerQueryByWxTradeNoRequest { 124 @SerializedName("sp_mchid") 125 @Expose(serialize = false) 126 public String spMchid; 127 128 @SerializedName("sub_mchid") 129 @Expose(serialize = false) 130 public String subMchid; 131 132 @SerializedName("transaction_id") 133 @Expose(serialize = false) 134 public String transactionId; 135 } 136 137 public static class GoodsDetailInPromotion { 138 @SerializedName("goods_id") 139 public String goodsId; 140 141 @SerializedName("quantity") 142 public Integer quantity; 143 144 @SerializedName("unit_price") 145 public Long unitPrice; 146 147 @SerializedName("discount_amount") 148 public Long discountAmount; 149 150 @SerializedName("goods_remark") 151 public String goodsRemark; 152 } 153 154 public static class PartnerAPIv3PartnerQueryResponse { 155 @SerializedName("sp_appid") 156 public String spAppid; 157 158 @SerializedName("sp_mchid") 159 public String spMchid; 160 161 @SerializedName("sub_appid") 162 public String subAppid; 163 164 @SerializedName("sub_mchid") 165 public String subMchid; 166 167 @SerializedName("out_trade_no") 168 public String outTradeNo; 169 170 @SerializedName("transaction_id") 171 public String transactionId; 172 173 @SerializedName("trade_type") 174 public String tradeType; 175 176 @SerializedName("trade_state") 177 public String tradeState; 178 179 @SerializedName("trade_state_desc") 180 public String tradeStateDesc; 181 182 @SerializedName("bank_type") 183 public String bankType; 184 185 @SerializedName("attach") 186 public String attach; 187 188 @SerializedName("success_time") 189 public String successTime; 190 191 @SerializedName("payer") 192 public PartnerCommRespPayerInfo payer; 193 194 @SerializedName("amount") 195 public CommRespAmountInfo amount; 196 197 @SerializedName("scene_info") 198 public CommRespSceneInfo sceneInfo; 199 200 @SerializedName("promotion_detail") 201 public List<PromotionDetail> promotionDetail; 202 } 203 204 public static class StoreInfo { 205 @SerializedName("id") 206 public String id; 207 208 @SerializedName("out_id") 209 public String outId; 210 } 211 212 public static class PartnerCommRespPayerInfo { 213 @SerializedName("sp_openid") 214 public String spOpenid; 215 216 @SerializedName("sub_openid") 217 public String subOpenid; 218 } 219 220 public static class PromotionDetail { 221 @SerializedName("coupon_id") 222 public String couponId; 223 224 @SerializedName("name") 225 public String name; 226 227 @SerializedName("scope") 228 public String scope; 229 230 @SerializedName("type") 231 public String type; 232 233 @SerializedName("amount") 234 public Long amount; 235 236 @SerializedName("stock_id") 237 public String stockId; 238 239 @SerializedName("wechatpay_contribute") 240 public Long wechatpayContribute; 241 242 @SerializedName("merchant_contribute") 243 public Long merchantContribute; 244 245 @SerializedName("other_contribute") 246 public Long otherContribute; 247 248 @SerializedName("currency") 249 public String currency; 250 251 @SerializedName("goods_detail") 252 public List<GoodsDetailInPromotion> goodsDetail; 253 } 254}
需配合微信支付工具库 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 "填入 商户号", // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考https://pay.weixin.qq.com/doc/v3/partner/4013080340 16 "填入 商户API证书序列号", // 商户API证书序列号,如何获取请参考https://pay.weixin.qq.com/doc/v3/partner/4013058924 17 "填入 商户API证书私钥文件路径", // 商户API证书私钥文件路径,本地文件路径 18 "填入 微信支付公钥ID", // 微信支付公钥ID,如何获取请参考https://pay.weixin.qq.com/doc/v3/partner/4013038589 19 "填入 微信支付公钥文件路径", // 微信支付公钥文件路径,本地文件路径 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 query.Add("sp_mchid", *request.SpMchid) 57 query.Add("sub_mchid", *request.SubMchid) 58 reqUrl.RawQuery = query.Encode() 59 httpRequest, err := http.NewRequest(method, reqUrl.String(), nil) 60 if err != nil { 61 return nil, err 62 } 63 httpRequest.Header.Set("Accept", "application/json") 64 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId()) 65 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), nil) 66 if err != nil { 67 return nil, err 68 } 69 httpRequest.Header.Set("Authorization", authorization) 70 71 client := &http.Client{} 72 httpResponse, err := client.Do(httpRequest) 73 if err != nil { 74 return nil, err 75 } 76 77 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 78 if err != nil { 79 return nil, err 80 } 81 82 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 { 83 // 2XX 成功,验证应答签名 84 err = wxpay_utility.ValidateResponse( 85 config.WechatPayPublicKeyId(), 86 config.WechatPayPublicKey(), 87 &httpResponse.Header, 88 respBody, 89 ) 90 if err != nil { 91 return nil, err 92 } 93 94 if err := json.Unmarshal(respBody, response); err != nil { 95 return nil, err 96 } 97 98 return response, nil 99 } else { 100 return nil, &wxpay_utility.ApiException{ 101 StatusCode: httpResponse.StatusCode, 102 Header: httpResponse.Header, 103 Body: respBody, 104 } 105 } 106} 107 108type CommRespAmountInfo struct { 109 Total *int64 `json:"total,omitempty"` 110 PayerTotal *int64 `json:"payer_total,omitempty"` 111 Currency *string `json:"currency,omitempty"` 112 PayerCurrency *string `json:"payer_currency,omitempty"` 113} 114 115type CommRespSceneInfo struct { 116 DeviceId *string `json:"device_id,omitempty"` 117} 118 119type PartnerQueryByWxTradeNoRequest struct { 120 SpMchid *string `json:"sp_mchid,omitempty"` 121 SubMchid *string `json:"sub_mchid,omitempty"` 122 TransactionId *string `json:"transaction_id,omitempty"` 123} 124 125func (o *PartnerQueryByWxTradeNoRequest) MarshalJSON() ([]byte, error) { 126 type Alias PartnerQueryByWxTradeNoRequest 127 a := &struct { 128 SpMchid *string `json:"sp_mchid,omitempty"` 129 SubMchid *string `json:"sub_mchid,omitempty"` 130 TransactionId *string `json:"transaction_id,omitempty"` 131 *Alias 132 }{ 133 // 序列化时移除非 Body 字段 134 SpMchid: nil, 135 SubMchid: nil, 136 TransactionId: nil, 137 Alias: (*Alias)(o), 138 } 139 return json.Marshal(a) 140} 141 142type GoodsDetailInPromotion struct { 143 GoodsId *string `json:"goods_id,omitempty"` 144 Quantity *int64 `json:"quantity,omitempty"` 145 UnitPrice *int64 `json:"unit_price,omitempty"` 146 DiscountAmount *int64 `json:"discount_amount,omitempty"` 147 GoodsRemark *string `json:"goods_remark,omitempty"` 148} 149 150type PartnerApiv3PartnerQueryResponse struct { 151 SpAppid *string `json:"sp_appid,omitempty"` 152 SpMchid *string `json:"sp_mchid,omitempty"` 153 SubAppid *string `json:"sub_appid,omitempty"` 154 SubMchid *string `json:"sub_mchid,omitempty"` 155 OutTradeNo *string `json:"out_trade_no,omitempty"` 156 TransactionId *string `json:"transaction_id,omitempty"` 157 TradeType *string `json:"trade_type,omitempty"` 158 TradeState *string `json:"trade_state,omitempty"` 159 TradeStateDesc *string `json:"trade_state_desc,omitempty"` 160 BankType *string `json:"bank_type,omitempty"` 161 Attach *string `json:"attach,omitempty"` 162 SuccessTime *string `json:"success_time,omitempty"` 163 Payer *PartnerCommRespPayerInfo `json:"payer,omitempty"` 164 Amount *CommRespAmountInfo `json:"amount,omitempty"` 165 SceneInfo *CommRespSceneInfo `json:"scene_info,omitempty"` 166 PromotionDetail []PromotionDetail `json:"promotion_detail,omitempty"` 167} 168 169type PartnerCommRespPayerInfo struct { 170 SpOpenid *string `json:"sp_openid,omitempty"` 171 SubOpenid *string `json:"sub_openid,omitempty"` 172} 173 174type PromotionDetail struct { 175 CouponId *string `json:"coupon_id,omitempty"` 176 Name *string `json:"name,omitempty"` 177 Scope *string `json:"scope,omitempty"` 178 Type *string `json:"type,omitempty"` 179 Amount *int64 `json:"amount,omitempty"` 180 StockId *string `json:"stock_id,omitempty"` 181 WechatpayContribute *int64 `json:"wechatpay_contribute,omitempty"` 182 MerchantContribute *int64 `json:"merchant_contribute,omitempty"` 183 OtherContribute *int64 `json:"other_contribute,omitempty"` 184 Currency *string `json:"currency,omitempty"` 185 GoodsDetail []GoodsDetailInPromotion `json:"goods_detail,omitempty"` 186}
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
应答参数
|
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" : "JSAPI", 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 | 系统错误 | 系统异常,请用相同参数重新调用 |