return_code=SUCCESS,return_msg=OK,result_code=FAIL,err_code_des=无效的openid,err_code=PARAM_ERROR
{ "appid", appid }, { "mch_id", mch_id }, { "nonce_str", nonceStr }, { "body", accStr },
{ "out_trade_no", Guid.NewGuid().ToString("N") }, { "total_fee",price },
{ "spbill_create_ip", request1.UserHostAddress.ToString() },
{ "notify_url", "https://www.maya-maya.cn:8083/api/WechatPay/payNotify" },
{ "trade_type", "JSAPI" }, { "openid", openid }//, { "sign", "" }
openid可以取到值,但是通不过。客户端如下
wx.login({
success: (res) => {
if (res.code) {
this.setData({openid: res.code});
console.log(res.code);
// 发起支付请求
wx.request({
wx.login 返回的是code
code 需要接口解密成openid 才可以使用
code 换取openid接口:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/code2Session.html
这是解密的返回值,是哪里出错了!
你打印一下openid看看,是哪个环节openid出现异常