本文為大家分享了java微信公眾號(hào)企業(yè)付款的開發(fā)代碼,供大家參考,具體內(nèi)容如下
詳情參照微信開發(fā)者文檔 企業(yè)付款文檔
java代碼 定義所傳遞的參數(shù)
@RequestMapping(value = "zhifu", method = RequestMethod.GET) public @ResponseBody String getWeixinOpenid(String code, HttpServletRequest request) { // 訂單號(hào) 自定義 生成32位uuid String partner_trade_no = UUIDGenerator.getUUID(); // 隨機(jī)數(shù) String nonce_str = UUIDGenerator.getUUID(); // 轉(zhuǎn)賬金額(分為單位)1-200 int jine = 100; // 企業(yè)付款信息 String desc = "轉(zhuǎn)賬"; // ip地址 String spbill_create_ip = "xx.xx.xx"; // re_user_name String re_user_name = "xx"; String check_name = CheckName.NO_CHECK.toString(); String zfpath = "D:/apiclient_cert.p12"; try { // 獲取openid String openid = WeChatUtil.getByOpenid(appid, secret, code); // 付款 boolean flag = WeChatUtil.enterprisePayment(openid, appid, mchid, nonce_str, partner_trade_no, re_user_name, jine, desc, spbill_create_ip, check_name, key, zfpath); // 成功 if (flag) { return "SUCCESS"; } } catch (Exception e) { System.err.println(e.getStackTrace()); } return "FAIL"; }