1.申請一個商戶號,並開通企業付款功能,需要下載api證書
2.在微信開放平臺申請app授權登錄的賬號(帶有appid),開通支付功能,在商戶號中如下圖所示,在appId授權管理中綁定該appId,這步做完前端可以獲取到openid
3.如果有小程序提現到微信的業務,申請小程序並開通支付功能,並在商戶號中綁定,前端靜默獲取code,傳給後端,後端用code獲取openid,存入數據庫
4.企業付款代碼參考微信官方網站
https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
//下邊是參考代碼,時間久遠,以備參考。
withdrawByWX.java
package com.naryou.controller.smallAndApp.live;
import com.naryou.config.ConfigUtil;
import com.naryou.utils.HmfAppJsonData;
import com.naryou.utils.HttpUtil;
import com.naryou.utils.payCorn.WXPayUtil;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.s