From f8791bbf07c92273be8c2a8750dfdb0324122a76 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 28 Nov 2025 02:01:39 +0000 Subject: [PATCH 1/2] Initial plan From 2f1a9d4df3ee7771ddc4d50948cba164ee3e6fb6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 28 Nov 2025 02:08:59 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20V3=20=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=95=86=E9=80=80=E6=AC=BE=E6=96=B9=E6=B3=95=20partne?= =?UTF-8?q?rRefundV3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com> --- .../wxpay/service/WxPayService.java | 26 +++++++++++++++++++ .../service/impl/BaseWxPayServiceImpl.java | 10 +++++++ 2 files changed, 36 insertions(+) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java index 82f05910f..93da0d133 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java @@ -839,6 +839,32 @@ public interface WxPayService { */ WxPayRefundV3Result refundV3(WxPayRefundV3Request request) throws WxPayException; + /** + *
+ * 微信支付-服务商申请退款. + * 应用场景 + * 当交易发生之后一年内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付金额退还给买家,微信支付将在收到退款请求并且验证成功之后,将支付款按原路退还至买家账号上。 + * + * 注意: + * 1、交易时间超过一年的订单无法提交退款 + * 2、微信支付退款支持单笔交易分多次退款(不超50次),多次退款需要提交原支付订单的商户订单号和设置不同的退款单号。申请退款总金额不能超过订单金额。 一笔退款失败后重新提交,请不要更换退款单号,请使用原商户退款单号 + * 3、错误或无效请求频率限制:6qps,即每秒钟异常或错误的退款申请请求不超过6次 + * 4、每个支付订单的部分退款次数不能超过50次 + * 5、如果同一个用户有多笔退款,建议分不同批次进行退款,避免并发退款导致退款失败 + * 6、申请退款接口的返回仅代表业务的受理情况,具体退款是否成功,需要通过退款查询接口获取结果 + * 7、一个月之前的订单申请退款频率限制为:5000/min + * + * 详见 https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_1_9.shtml + * 接口地址 + * https://api.mch.weixin.qq.com/v3/refund/domestic/refunds + *+ * + * @param request 请求对象 + * @return 退款操作结果 wx pay refund result + * @throws WxPayException the wx pay exception + */ + WxPayRefundV3Result partnerRefundV3(WxPayPartnerRefundV3Request request) throws WxPayException; + /** *
* 微信支付-查询退款.
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
index 4c01836bb..ba3dc3714 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
@@ -264,6 +264,16 @@ public WxPayRefundV3Result refundV3(WxPayRefundV3Request request) throws WxPayEx
return GSON.fromJson(response, WxPayRefundV3Result.class);
}
+ @Override
+ public WxPayRefundV3Result partnerRefundV3(WxPayPartnerRefundV3Request request) throws WxPayException {
+ if (StringUtils.isBlank(request.getSubMchid())) {
+ request.setSubMchid(this.getConfig().getSubMchId());
+ }
+ String url = String.format("%s/v3/refund/domestic/refunds", this.getPayBaseUrl());
+ String response = this.postV3WithWechatpaySerial(url, GSON.toJson(request));
+ return GSON.fromJson(response, WxPayRefundV3Result.class);
+ }
+
@Override
public WxPayRefundQueryResult refundQuery(String transactionId, String outTradeNo, String outRefundNo, String refundId)
throws WxPayException {