导入weixin4j-server,weixin4j-base,用的是sdk
runtime ‘com.foxinmy:weixin4j-base:1.6.9‘ runtime ‘com.foxinmy:weixin4j-server:1.1.8‘
付款代码:
WeixinPayAccount payAccount = new WeixinPayAccount(‘AppId‘, ‘商户支付密钥(32位,后台配置)‘, ‘商户号‘) Weixin4jSettings settings = new Weixin4jSettings(payAccount, ‘p12证书路径‘) WeixinPayProxy weixinPayProxy = new WeixinPayProxy(settings); // 或者自定义传入Weixin4jSettings对象 CorpPayment corpPayment = new CorpPayment(‘订单号‘, ‘openId‘, CorpPaymentCheckNameType.NO_CHECK, ‘备注‘, 金额, ‘ip地址‘) def res = weixinPayProxy.sendCorpPayment(corpPayment)
输出的res是交易号
原文地址:http://xiaosa.blog.51cto.com/665033/1774838