没有合适的资源?快使用搜索试试~ 我知道了~
java微信退款的代码片段 支持部分退款
需积分: 5 12 下载量 147 浏览量
2018-11-14
11:44:26
上传
评论
收藏 1KB TXT 举报
温馨提示
试读
2页
使用weixin-java-tools进行微信退款的代码片段, 支持部分退款 ,包括maven的pom依赖片段。
资源推荐
资源详情
资源评论
import java.math.BigDecimal;
import com.alibaba.fastjson.JSON;
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
public class WeixinRefund {
public static int refund() {
WxPayConfig payConfig = new WxPayConfig();
payConfig.setAppId("微信APPID");
payConfig.setMchId("微信商户号");
payConfig.setMchKey("微信支付KEY");
payConfig.setKeyPath("微信支付秘钥路径");
WxPayService wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(payConfig);
WxPayRefundRequest request = new WxPayRefundRequest();
request.setOutRefundNo("随机退款单号");
request.setOutTradeNo("商户订单号");
request.setRefundFee(退款金额); // 注意!以分为单位
request.setRefundDesc("退款备注");
request.setTotalFee(订单总金额); // 注意!以分为单位
try {
WxPayRefundResult result = wxPayService.refund(request);
import com.alibaba.fastjson.JSON;
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
public class WeixinRefund {
public static int refund() {
WxPayConfig payConfig = new WxPayConfig();
payConfig.setAppId("微信APPID");
payConfig.setMchId("微信商户号");
payConfig.setMchKey("微信支付KEY");
payConfig.setKeyPath("微信支付秘钥路径");
WxPayService wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(payConfig);
WxPayRefundRequest request = new WxPayRefundRequest();
request.setOutRefundNo("随机退款单号");
request.setOutTradeNo("商户订单号");
request.setRefundFee(退款金额); // 注意!以分为单位
request.setRefundDesc("退款备注");
request.setTotalFee(订单总金额); // 注意!以分为单位
try {
WxPayRefundResult result = wxPayService.refund(request);
资源评论
氧气是我
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功