收藏
回答

统一下单 返回的错误信息 能不能 更详细点

终端IPspbill_create_ipString(64)123.12.12.123支持IPV4和IPV6两种格式的IP地址。用户的客户端IP


{ return_code: { _cdata: 'FAIL' },

  return_msg: { _cdata: '签名错误' } }




    //调用支付统一下单api

    let query = {

      appid: Utils.wx.appid,//appid

      mch_id: Utils.wx.mch_id,

      nonce_str: Utils.get_random(),//随机数 32位

      body: 'xxxx',//商品描述

      out_trade_no: moment().format('YYYYMMDD-HHmmss'),//商户订单号

      total_fee: 1,//标价金额

      spbill_create_ip: headers['x-real-ip'],//终端IP

      notify_url: encodeURIComponent('https://www.toboedu.com/api/english_mini/pay/callback'),//通知地址

      trade_type: 'JSAPI',//交易类型

      openid: param.openid,//用户openid

      sign_type:'MD5',//加密方式

    };

    //生成签名

    query.sign = Utils.get_sign(query);

    let xml = `<xml>\n${xmljs.json2xml(query,{compact: true, ignoreComment: true, spaces: 4})}\n</xml>`;

    const data = await this.ctx.curl('https://api.mch.weixin.qq.com/pay/unifiedorder', {

      method: 'POST',

      content: xml,

      dataType: 'xml',

    });



1、已经用签名工具校验过  已通过;

2、开发工具请求 返回错误;



最后一次编辑于  2019-06-18
回答关注问题邀请回答
收藏

2 个回答

  • 微信支付技术助手4
    微信支付技术助手4
    2019-06-18

    请检查参数和秘钥

    2019-06-18
    有用
    回复
  • 阿zhi
    阿zhi
    2019-06-18

    商户key 错误;  扫码登陆的时候 请选择 对应的商户;复制正确的 商户api key

    2019-06-18
    有用
    回复
登录 后发表内容