微信公众号支付开发
微信公众号支付开发 微信公众号支付业务流程如下: 设置授权域名 参考: 微信公众号支付设置支付目录 统一下单 授权登录,获取openid 下单之前,前端要先判断是否有openid,如果没有,需要首先调用后台授权接口得到openid。我们可以使用第三方SDK来做授权操作,这样比较简单。参考: 微信公众号支付授权登录 。 首先,项目中引入第三方SDK的依赖: < dependency > < groupId > com.github.binarywang </ groupId > < artifactId > weixin-java-mp </ artifactId > < version > 3.0.0 </ version > </ dependency > 授权登录需要商户的AppId和AppSecret,可以通过配置文件注入。首先在application.yml中配置这两个属性: myAppSecret: 075419ce8d3f95a3b49304d84d98cee5 然后创建一个类用来存放这些属性的值: @Component @ConfigurationProperties (prefix = "wechat" ) @Data public class private String myAppId private String myAppSecret private