收藏
回答

midasPay接口一直报错,求助啊

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小游戏 Bug midasPay 工具 6.67 x.xx.x.x

midasPay一直报 errcode:40101 errmsg:"mp_sig missing"错误

明明传了mp_sig了

而且用了同样的签名方法取getbalance接口数据没问题

url: https://api.weixin.qq.com/cgi-bin/midas/sandbox/pay?access_token=11_aD4_sX6a1VehVOjl6kIY_wtfmFH7DuVDUYGxqgMYnhoE_HCR_Fyi7wQbt30ZTxQyD0IxWGIYS3LyeIZwU3FRkD3-w8T_oXt_pb0s_MJemGiBdQ7xfEEBEZ1EwQ02naBr8osXuomHrYtGZhHFIXCgABAMBG

post json: {"openid":"o8bIu5d4r-HaPwyNG9iU--NG8dDU","appid":"wxc1a356743b43384c","offer_id":"1450015803","ts":1531745801,"zone_id":"1","pf":"android","user_ip":"::ffff:127.0.0.1","amt":150,"bill_no":"BillNo_29","pay_item":"钻石","app_remark":"无","sig":"77bc4625396c2bb23e4b0a69a563fe8b0276da103e8f447eddc3286e7b2e798b","access_token":"11_aD4_sX6a1VehVOjl6kIY_wtfmFH7DuVDUYGxqgMYnhoE_HCR_Fyi7wQbt30ZTxQyD0IxWGIYS3LyeIZwU3FRkD3-w8T_oXt_pb0s_MJemGiBdQ7xfEEBEZ1EwQ02naBr8osXuomHrYtGZhHFIXCgABAMBG","mp_sig":"4b5f92e43f5998366cb31b86e380437e2dc7638731b07e135b53cb32514ad5d1"}

返回:{errcode:40101 errmsg:"mp_sig missing"}

求助啊!!!!!!


附:

签名方法





exports.midasPay = async (amt,bill_no,pay_item,app_remark,userId,req,callback)=>{

    let userIp = widgets.getClientIp(req);

    let uData = await controls.getUserBalanceData(userId);

    let accessToken = await getAccessToken(userId,uData.debug);

    let uri = configs.MidaspayEnv=='dev'?'/cgi-bin/midas/sandbox/pay':'/cgi-bin/midas/pay';

    let params = {

        openid:uData.openid,

        appid:uData.debug?configs.DebugAppId:configs.AppId,

        offer_id:MidasOfferId,

        ts:parseInt(new Date().getTime()/1000),

        zone_id:'1',

        pf:'android',

        user_ip:userIp,

        amt:amt,//扣除游戏币数量,不能为 0

        bill_no:'BillNo_'+bill_no,//订单号,业务需要保证全局唯一;相同的订单号不会重复扣款。长度不超过63,只能是数字、大小写字母_-

        pay_item:pay_item,//道具名称

        app_remark:app_remark+'无',//备注。会写到账户流水

    };

    midasSign(params,uri,uData.session_key,accessToken);

    log.d(params);

    xhttp.post('https://api.weixin.qq.com'+uri+'?access_token='+accessToken,JSON.stringify(params),(ret)=>{

        callback(ret.body);

    },{contentType:'application/json',type:'json'});

};


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