💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
引入微信的JSSDK ~~~ <!--微信的JSSDK--> <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> ~~~ ~~~ function pay(){ showLoading() fetch("/trans/mp_pay", { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id, '_token': '{{ csrf_token() }}' }) }).then(response => response.json()).then(data => { hideLoading() if(data.code == 419){ mui.alert('', data.msg,'ماقۇل، ھازىرلا كىرەي', function (){ location.href = '{{ route('trans.vip', ['type'=>'login']) }}' }) return false; } //弹出支付窗口 wx.chooseWXPay({ timestamp: data.timeStamp, // 支付签名时间戳, nonceStr: data.nonceStr, // 支付签名随机串,不长于 32 位 package: data.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=xxxx) signType: data.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5' paySign: data.paySign, // 支付签名 success: function (res) { // 支付成功后的回调函数 console.log(res) // res.errMsg === 'chooseWXPay:ok'方式判断前端返回,微信团队郑重提示: // res.errMsg将在用户支付成功后返回ok,但并不保证它绝对可靠, 切记。 if (res.errMsg === 'chooseWXPay:ok') { mui.toast('پۇل تۆلەش تامام',{ duration:'long', type:'div' }) setTimeout(()=>{ location.reload() },2000) } }, cancel: function (res) { mui.toast('پۇل تۆلەش مەغلۇب بولدى!',{ duration:'long', type:'div' }) }, // 支付失败回调函数 fail: function (res) { mui.toast('پۇل تۆلەش مەغلۇب بولدى!',{ duration:'long', type:'div' }) } }); }).catch(error => { console.error('error') }) } ~~~