var key = getApp().gDt.mch_key;
var appid = getApp().gDt.appid;//appid
var vtimeStamp = createTimeStamp();
var vnonce_str = randomString();
var vpackage = encodeURI('点击奖励');
var vsignType = 'MD5';
console.log(vnonce_str.length);
var stringSignTemp = "appid=" + appid + "&nonce_str=" + vnonce_str + "&package=" + vpackage + "&timeStamp=" + vtimeStamp + "&key=" + key;
console.log(stringSignTemp);
//stringSignTemp = URLencode(stringSignTemp);
var md5i = MD5.MD5(stringSignTemp);
console.log(md5i);
var vsign = md5i;
wx.sendBizRedPacket({
timeStamp: vtimeStamp,
nonceStr: vnonce_str,
package: vpackage,
signType: vsignType,
paySign: vsign,
success: function (res)
{
console.log('success')
},
fail: function (res) {
console.log('红包fail')
console.log(res)
},
complete: function (res) {
console.log('红包complete')
}
})
小程序红包详细教程 无需任何资质,不懂得问我哦https://developers.weixin.qq.com/community/develop/article/doc/000c6009a5cbd805d8790d4ab56013
核对签名参数,KEY,以及注意参数编码。