微信公众平台注册-申请微信支付
package com.cn.config;
import com.cn.controller.WXPayController;
import com.github.wxpay.sdk.WXPayUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
/**
* @Descripation 微信支付
* @Date 2019-08-02 9:26
* @since 1.0
**/
public class WXUtils {
private static final Logger logger = LoggerFactory.getLogger(WXPayController.class);
//从你的微信平台获取
private static final String appid = "";
private static final String mch_id = " ";
private static final String partnerkey = ""; //商户秘钥
/* *
* @Description 调用统一下单接口
* param 1 商品订单号 2 total_fee 支付金额 订单号前端传,金额必须后端查 订单号32位
*/
public static Map unifyPay(String out_trade_no, String total_fee) {
String url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
Map<String, String> param = new HashMap<>();
param.put("appid", appid);
param.put("mch_id", mch_id);
String nonce_str = WXPayUtil.generateNonceStr();
param.put("nonce_str", nonce_str);
param.put("body", "");
param.put("out_trade_no", out_trade_no);
param.<