-
Notifications
You must be signed in to change notification settings - Fork 490
微信支付开发设置
borball edited this page Dec 29, 2016
·
6 revisions
-
默认配置方式
可以直接在 classpath 下面增加 wx-pay-settings.xml,内容如下:
<PaySetting> <appId>your appId</appId> <mchId>your mchId</mchId> <key>your key of the certificate</key> <certPath>the path of your certificate</certPath> <certPassword>your password of your certificate</certPassword> </PaySetting>
使用说明, 以微信红包为例
RedPackRequest redPackRequest = new RedPackRequest(); redPackRequest.setActivityName("土豪发红包"); redPackRequest.setAmount(100); redPackRequest.setBillNumber("1292063901201605150012300014"); redPackRequest.setNumber(1); redPackRequest.setOpenId("oELhlt7Q-lRmLbRsPsaKeVX6pqjg"); redPackRequest.setRemark("测试发红包"); redPackRequest.setWishing("恭喜发财"); redPackRequest.setClientIp("127.0.0.1"); redPackRequest.setSendName("创河软件"); RedPackResponse redPackResponse = RedPacks.defaultRedPacks().sendSingle(redPackRequest);
-
使用编程的方式:
PaySetting paySetting = new PaySetting(); //set all the mandatory attributes RedPackResponse redPackResponse = RedPacks.with(paySetting).sendSingle(redPackRequest);