微信扣款和退款

本文介绍了微信支付的扣款测试过程,展示了一段成功的扣款XML响应示例。同时,提到了在退款过程中可能出现的问题——缺少证书,这会导致退款异常。
摘要由CSDN通过智能技术生成
扣款接口实现
/**
 * @param :out_trade_no-订单号;total_fee-订单总金额;contract_id-签约成功后,微信返回的委托代扣协议id
 * @Author : lilong
 * @Description :微信支付扣款
 * @Date : 11:16 2018/5/4
 **/
public void wxDeductMoney(String out_trade_no, Integer total_fee, String contract_id) throws Exception {
    //扣款请求的参数集合
    Map<String, String> map = new HashMap<>();
    //签名所需要的参数
    //生成随机数
    String nonce_str = getNonce();
    String body = "HH";
    String detail = "HH";
    String attach = "666";
    String fee_type = "CNY";
    String spbill_create_ip = "192.168.1.1";
    String goods_tag = "WXG";
    String notify_url = "http://www.sz.cn/mvc/wechat/callbackDeductMoney";//回调
    //交易类型---微信委托代扣支付
    String trade_type = "PAP";
    map.put("appid", appid);
    map.put("mch_id", mch_id);
    map.put("nonce_str", nonce_str);
    map.put("body", body);
    map.put("detail", detail);
    map.put("attach", attach);
    map.put("out_trade_no", out_trade_no);
    map.put("total_fee", total_fee.toString());
    map.put("fee_type", fee_type);
    map.put("spbill_create_ip", spbill_create_ip);
    map.put("goods_tag", goods_tag);
    map.put("notify_url", notify_url);
    map.put("trade_type", trade_type);
    map.put(
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值