刚开始做,网上找了很多,下载了三个demo,最后发现,这玩意还是需要个干货!
讲重点:
1.下载微信官方的SDK
选择下载java版本最佳实践。
2.将以下文件拷到你的项目中
3.在同文件夹下创建此继承类
package com.***.utils.wx;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
* @Description: 微信支付配置类
* @Author: hm
* @CreateDate: 2018/12/10 17:19.
* @UpdateDate: 2018/12/10 17:19.
* @Version: 1.0
*/
public class MyConfig extends WXPayConfig {
private byte[] certData;
public MyConfig() throws Exception {
// String certPath = "classpath:apiclient_cert.p12";
// File file = new File(certPath);
// InputStream certStream = new FileInputStream(file);
// this.certData = new byte[(int) file.length()];
// certStream.read(this.certData);
// certStream.close();
}
@Override
public String getAppID() {
return "你的appid";
}
@Override
public String getMchID() {
return "你的商户id";
}
@Override