1
0
mirror of synced 2025-12-16 12:25:33 +08:00

🆕 #3737 【微信支付】增加V3服务商申请退款的接口

This commit is contained in:
Copilot
2025-11-28 11:26:46 +08:00
committed by GitHub
parent 03114b9900
commit c4f383462e
2 changed files with 36 additions and 0 deletions

View File

@@ -839,6 +839,32 @@ public interface WxPayService {
*/
WxPayRefundV3Result refundV3(WxPayRefundV3Request request) throws WxPayException;
/**
* <pre>
* 微信支付-服务商申请退款.
* 应用场景
* 当交易发生之后一年内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付金额退还给买家,微信支付将在收到退款请求并且验证成功之后,将支付款按原路退还至买家账号上。
*
* 注意:
* 1、交易时间超过一年的订单无法提交退款
* 2、微信支付退款支持单笔交易分多次退款不超50次多次退款需要提交原支付订单的商户订单号和设置不同的退款单号。申请退款总金额不能超过订单金额。 一笔退款失败后重新提交,请不要更换退款单号,请使用原商户退款单号
* 3、错误或无效请求频率限制6qps即每秒钟异常或错误的退款申请请求不超过6次
* 4、每个支付订单的部分退款次数不能超过50次
* 5、如果同一个用户有多笔退款建议分不同批次进行退款避免并发退款导致退款失败
* 6、申请退款接口的返回仅代表业务的受理情况具体退款是否成功需要通过退款查询接口获取结果
* 7、一个月之前的订单申请退款频率限制为5000/min
*
* 详见 <a href="https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_1_9.shtml">https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_1_9.shtml</a>
* 接口地址
* https://api.mch.weixin.qq.com/v3/refund/domestic/refunds
* </pre>
*
* @param request 请求对象
* @return 退款操作结果 wx pay refund result
* @throws WxPayException the wx pay exception
*/
WxPayRefundV3Result partnerRefundV3(WxPayPartnerRefundV3Request request) throws WxPayException;
/**
* <pre>
* 微信支付-查询退款.

View File

@@ -264,6 +264,16 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
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 {