更新退款审批结果
更新时间:2025.09.01针对“申请退款单”,需要商户明确返回是否可退款的审批结果。
若根据用户描述,核实可以退款,审批动作传入“APPROVE”,同意退款,并给出一个预计退款时间。传入“同意退款”后,需要额外调退款接口发起原路退款。退款到账后,投诉单的状态将自动扭转为“处理完成”。
若根据用户描述,核实不能退款,审批动作传入“REJECT”,拒绝退款,并说明拒绝退款原因。驳回退款后,投诉单的状态将自动扭转为“处理完成”。
接口说明
支持商户:【普通商户】
请求方式:【POST】/v3/merchant-service/complaints-v2/{complaint_id}/update-refund-progress
请求域名:【主域名】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
path 路径参数
complaint_id 必填 string(64)
【投诉单号】 投诉单对应的投诉单号
body 包体参数
action 必填 string
【审批动作】 同意 或 拒绝
可选取值
REJECT
: 拒绝退款APPROVE
: 同意退款
launch_refund_day 选填 integer
【预计发起退款时间】 在同意退款时返回,预计将在多少个工作日内能发起退款, 0代表当天
reject_reason 选填 string(200)
【拒绝退款原因】 在拒绝退款时返回拒绝退款的原因
reject_media_list 选填 array[string]
【拒绝退款的举证图片列表】 在拒绝退款时,如果有拒绝的图片举证,可以提供 最多上传4张图片, 传入调用“商户上传反馈图片”接口返回的media_id,最多上传4张图片凭证
remark 选填 string(200)
【备注】 任何需要向微信支付客服反馈的信息
请求示例
POST
1curl -X POST \ 2 https://api.mch.weixin.qq.com/v3/merchant-service/complaints-v2/200201820200101080076610000/update-refund-progress \ 3 -H "Authorization: WECHATPAY2-SHA256-RSA2048 mchid=\"1900000001\",..." \ 4 -H "Accept: application/json" \ 5 -H "Content-Type: application/json" \ 6 -d '{ 7 "action" : "APPROVE", 8 "launch_refund_day" : 3, 9 "reject_reason" : "拒绝退款", 10 "reject_media_list" : [ 11 "aabbccdd" 12 ], 13 "remark" : "已处理完成" 14 }' 15
需配合微信支付工具库 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 UpdateRefundProgress { 26 private static String HOST = "https://api.mch.weixin.qq.com"; 27 private static String METHOD = "POST"; 28 private static String PATH = "/v3/merchant-service/complaints-v2/{complaint_id}/update-refund-progress"; 29 30 public static void main(String[] args) { 31 // TODO: 请准备商户开发必要参数,参考:https://pay.weixin.qq.com/doc/v3/merchant/4013070756 32 UpdateRefundProgress client = new UpdateRefundProgress( 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 , 37 "PUB_KEY_ID_xxxxxxxxxxxxx", // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816 38 "/path/to/wxp_pub.pem" // 微信支付公钥文件路径,本地文件路径 39 ); 40 41 UpdateRefundProgressRequest request = new UpdateRefundProgressRequest(); 42 request.complaintId = "200201820200101080076610000"; 43 request.action = Action.APPROVE; 44 request.launchRefundDay = 3L; 45 request.rejectReason = "拒绝退款"; 46 request.rejectMediaList = new ArrayList<>(); 47 { 48 request.rejectMediaList.add("aabbccdd"); 49 }; 50 request.remark = "已处理完成"; 51 try { 52 client.run(request); 53 } catch (WXPayUtility.ApiException e) { 54 // TODO: 请求失败,根据状态码执行不同的逻辑 55 e.printStackTrace(); 56 } 57 } 58 59 public void run(UpdateRefundProgressRequest request) { 60 String uri = PATH; 61 uri = uri.replace("{complaint_id}", WXPayUtility.urlEncode(request.complaintId)); 62 String reqBody = WXPayUtility.toJson(request); 63 64 Request.Builder reqBuilder = new Request.Builder().url(HOST + uri); 65 reqBuilder.addHeader("Accept", "application/json"); 66 reqBuilder.addHeader("Wechatpay-Serial", wechatPayPublicKeyId); 67 reqBuilder.addHeader("Authorization", WXPayUtility.buildAuthorization(mchid, certificateSerialNo,privateKey, METHOD, uri, reqBody)); 68 reqBuilder.addHeader("Content-Type", "application/json"); 69 RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), reqBody); 70 reqBuilder.method(METHOD, requestBody); 71 Request httpRequest = reqBuilder.build(); 72 73 // 发送HTTP请求 74 OkHttpClient client = new OkHttpClient.Builder().build(); 75 try (Response httpResponse = client.newCall(httpRequest).execute()) { 76 String respBody = WXPayUtility.extractBody(httpResponse); 77 if (httpResponse.code() >= 200 && httpResponse.code() < 300) { 78 // 2XX 成功,验证应答签名 79 WXPayUtility.validateResponse(this.wechatPayPublicKeyId, this.wechatPayPublicKey, 80 httpResponse.headers(), respBody); 81 82 return; 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 UpdateRefundProgress(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 UpdateRefundProgressRequest { 106 @SerializedName("complaint_id") 107 @Expose(serialize = false) 108 public String complaintId; 109 110 @SerializedName("action") 111 public Action action; 112 113 @SerializedName("launch_refund_day") 114 public Long launchRefundDay; 115 116 @SerializedName("reject_reason") 117 public String rejectReason; 118 119 @SerializedName("reject_media_list") 120 public List<String> rejectMediaList; 121 122 @SerializedName("remark") 123 public String remark; 124 } 125 126 public enum Action { 127 @SerializedName("REJECT") 128 REJECT, 129 @SerializedName("APPROVE") 130 APPROVE 131 } 132 133} 134
需配合微信支付工具库 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 "strings" 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 := &UpdateRefundProgressRequest{ 28 ComplaintId: wxpay_utility.String("200201820200101080076610000"), 29 Action: ACTION_APPROVE.Ptr(), 30 LaunchRefundDay: wxpay_utility.Int64(3), 31 RejectReason: wxpay_utility.String("拒绝退款"), 32 RejectMediaList: []string{"aabbccdd"}, 33 Remark: wxpay_utility.String("已处理完成"), 34 } 35 36 err = UpdateRefundProgress(config, request) 37 if err != nil { 38 fmt.Printf("请求失败: %+v\n", err) 39 // TODO: 请求失败,根据状态码执行不同的处理 40 return 41 } 42 43 // TODO: 请求成功,继续业务逻辑 44 fmt.Println("请求成功") 45} 46 47func UpdateRefundProgress(config *wxpay_utility.MchConfig, request *UpdateRefundProgressRequest) (err error) { 48 const ( 49 host = "https://api.mch.weixin.qq.com" 50 method = "POST" 51 path = "/v3/merchant-service/complaints-v2/{complaint_id}/update-refund-progress" 52 ) 53 54 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path)) 55 if err != nil { 56 return err 57 } 58 reqUrl.Path = strings.Replace(reqUrl.Path, "{complaint_id}", url.PathEscape(*request.ComplaintId), -1) 59 reqBody, err := json.Marshal(request) 60 if err != nil { 61 return err 62 } 63 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody)) 64 if err != nil { 65 return 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 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 err 80 } 81 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse) 82 if err != nil { 83 return 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 err 95 } 96 return nil 97 } else { 98 return wxpay_utility.NewApiException( 99 httpResponse.StatusCode, 100 httpResponse.Header, 101 respBody, 102 ) 103 } 104} 105 106type UpdateRefundProgressRequest struct { 107 ComplaintId *string `json:"complaint_id,omitempty"` 108 Action *Action `json:"action,omitempty"` 109 LaunchRefundDay *int64 `json:"launch_refund_day,omitempty"` 110 RejectReason *string `json:"reject_reason,omitempty"` 111 RejectMediaList []string `json:"reject_media_list,omitempty"` 112 Remark *string `json:"remark,omitempty"` 113} 114 115func (o *UpdateRefundProgressRequest) MarshalJSON() ([]byte, error) { 116 type Alias UpdateRefundProgressRequest 117 a := &struct { 118 ComplaintId *string `json:"complaint_id,omitempty"` 119 *Alias 120 }{ 121 // 序列化时移除非 Body 字段 122 ComplaintId: nil, 123 Alias: (*Alias)(o), 124 } 125 return json.Marshal(a) 126} 127 128type Action string 129 130func (e Action) Ptr() *Action { 131 return &e 132} 133 134const ( 135 ACTION_REJECT Action = "REJECT" 136 ACTION_APPROVE Action = "APPROVE" 137) 138
应答参数
无应答包体
应答示例
204 No Content
1'无应答包体' 2
错误码
公共错误码
状态码 | 错误码 | 描述 | 解决方案 |
---|---|---|---|
400 | PARAM_ERROR | 参数错误 | 请根据错误提示正确传入参数 |
400 | INVALID_REQUEST | HTTP 请求不符合微信支付 APIv3 接口规则 | 请参阅 接口规则 |
401 | SIGN_ERROR | 验证不通过 | 请参阅 签名常见问题 |
500 | SYSTEM_ERROR | 系统异常,请稍后重试 | 请稍后重试 |