收藏
回答

小程序无法进行支付

利用微信开发者工具发起支付扫码正常支付,但是使用真机调试总是提示下面这个,后端是php的,https还有ssl证书都是正常使用的。手机上点击支付无法唤起。

Page({
  
  huoquopenidfunction(e{//插入数据 
    wx.login({
      successfunction (res{
        console.log(res)
        if (res.code) {
          console.log('通过login接口的code换取openid');
          //通过code 换取openid--开始
            var code = res.code
                          wx.request({
                            url'https://www.隐藏.com/wepay/huoquopenid.php',
                            data: {
                              code
                            },
                            method'GET',
                            header: { 'content-type''application/json' },
                            successfunction (openIdRes{
                              console.info("登录成功返回的openId:" + openIdRes.data.openid);


                              console.info("登录成功返回的unionid:" + openIdRes.data.unionid);


                              console.info("登录成功返回的session_key:" + openIdRes.data.session_key);



                               //调用付款--开始
              wx.request({
                url'https://www.隐藏.com/wepay/payfee.php'//改成你自己的链接
                data: {
                  id: openIdRes.data.openid, //获取用户openid
                  fee0.01 //商品价格
                },
                header: {
                  'Content-Type''application/x-www-form-urlencoded'
                },
                method'POST',
                successfunction (res{
                  console.log(res.data);
                  console.log('调起支付');
                  wx.requestPayment({
                    'timeStamp': res.data.timeStamp,
                    'nonceStr': res.data.nonceStr,
                    'package': res.data.package,
                    'signType''MD5',
                    'paySign': res.data.paySign,
                    'success'function (res{
                      console.log('付款成功-12580code.com');


                    },
                    'fail'function (res{
                      console.log(res);
                    },
                    'complete'function (res{
                      
                      console.log('完成');
                    }
                  });
                },
                failfunction (res{
                  console.log(res.data)
                }
              });
              //调用付款--结束




                            },
                            failfunction (error{
                              console.info("获取用户openId失败");
                              console.info(error);
                            }
                          })
        //通过code 换取openid--结束
        }
      }
    })





  }
  
  
 
})


最后一次编辑于  2022-12-01
回答关注问题邀请回答
收藏
登录 后发表内容