轉載請標明出處:juejin.im/post/5ce520… ,謝謝。php
PayReq request = new PayReq();
request.appId = WechatHelper.APP_ID;
request.partnerId = dataObj.optString("mch_id");
request.prepayId = dataObj.optString("prepay_id");
request.packageValue = dataObj.optString("package");
request.nonceStr = dataObj.optString("nonce_str");
request.timeStamp = dataObj.optString("timestamp");
request.sign = dataObj.optString("sign");
api.sendReq(request);
複製代碼
api.sendReq(request);
以前要註冊到微信registerApp(APP_ID)
。MD5
和HMAC-SHA256
,如今微信好像默認爲HMAC-SHA256
;