收藏
回答

H5支付得到预支付id但是无法唤起微信app支付页面原因

commodityId:21874

skuId:42094

type:1

num:1

oid:null

_request:Current HttpServletRequest

2019-06-24 13:13:19.926  INFO 4228 --- [nio-8080-exec-3] com.juyi.util.web.HttpServletUtils       : x-forwarded-for: null

微信支付请求参数: {}===>>>微信 pay 返回的XML: {}===>>>

<return_msg><![CDATA[OK]]></return_msg>

<nonce_str><![CDATA[QPY0eKhJksq8JbGM]]></nonce_str>

<sign><![CDATA[D20CE61E626667AFFA9D0F5F232F276E]]></sign>

<result_code><![CDATA[SUCCESS]]></result_code>

<prepay_id><![CDATA[wx24131319221873a64ca665001924080700]]></prepay_id>

<trade_type><![CDATA[MWEB]]></trade_type>

https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx24131319221873a64ca665001924080700&package=931174300]]>

微信返回支付链接————————https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx24131319221873a64ca665001924080700&package=931174300支付结果 ===>>>https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx24131319221873a64ca665001924080700&package=931174300

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>巨亿商城</title>
<link rel="stylesheet" type="text/css" href="/css/commoditydetail.css">
<script src="/js/jquery-3.4.0.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function() {
        var commodityid = $("#commoditydetailinput").val();
        $.ajax({
            url : '/storeCommodityRest/'+commodityid+'',//{commodityid}//394
            type : 'GET',
            dataType : 'json',
            timeout : 1000,
            cache : false,
            //beforeSend : LoadFunction, //加载执行方法
            //error : erryFunction, //错误执行方法
            success : succFunction //成功执行方法
        })
        /* function LoadFunction() {
            $("#commoditydetailshow").html('加载中...');
        }
        function erryFunction() {
            alert("error");
        } */
        function succFunction(tt) {
            //$("#commoditydetailshow_1").html('');
            //eval将字符串转成对象数组
            //var json = { "id": "10086", "uname": "zhangsan", "email": "zhangsan@qq.com" };
            //json = eval(json);
            //alert("===json:id=" + json.id + ",uname=" + json.uname + ",email=" + json.email);
  
            /*  var json = eval(tt);     
              $.each(json, function (index, item) {
                 //循环获取数据
                 var goodsname = json[index].goodsname;
                 var goodsnumber = json[index].goodsnumber;
                 var brandid = json[index].brandid;
                 $("#commoditydetailshow").html($("#commoditydetailshow").html() + "<br>" + goodsname + " - " + goodsnumber + " - " + brandid + "<br/>");
             });  */
            var json = eval(tt);
            //var goodsname = json.goodsname;
            //var goodsnumber = json.goodsnumber;
            //var brandid = json.brandid;
            //var goodstitileimgurls = json.goodstitileimgurls;
            $("#commoditydetailshow_1").html($("#commoditydetailshow_1").html()
            +"<li><img alt='图片' src='/img/"+json.goodstitileimgurls+"'></li>"
            +"<li><span>价格:¥"+json.marketprice+"</span></li>"
            +"<li><p>"+json.goodsname+"</p></li>"
            );
            $("#commoditydetailshow_2_1").html($("#commoditydetailshow_2_1").html()+"<span>商品详情</span>");
            $("#commoditydetailshow_2_2").html($("#commoditydetailshow_2_2").html()+"<img alt='图片' src='/img/"+json.goodsgraphicdetails+"'>");
        }
    });
</script>
  
<script type="text/javascript">
var url_toPay = "/pay/topay";
  
function GetQueryString(name)
{   
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");   
    var r = window.location.search.substr(1).match(reg);
    //search,查询?后面的参数,并匹配正则   
    if(r!=null)
        return  unescape(r[2]);
    return null;
}
//http://127.0.0.1:8080/ai/show?c=21874&s=42094&t=0&=1
//http://47.95.192.81:8092/ai/show?c=21874&s=42094&t=0&=1
function toPay()
{
    //var phoneNumber = $("#commoditydetailinput_1").val();
    var commodityid = $("#commoditydetailinput").val();
    var skuid = $("#commoditydetailshow_3").val();
    //var goodsnumber = $("#commoditydetailshow_5").val();
    var num = 1;
    var iType = 1;//GetQueryString("t")
    $.get(
            url_toPay,
            {
                //phoneNumber:phoneNumber,
                commodityId:21874,//commodityid,//21874,GetQueryString("c")
                skuId:42094,//skuid,//'42094',GetQueryString("s")
                type:iType,
                num:num,//goodsnumber,//GetQueryString("n")
            },
            function(data)
            {     
                //alert(data);
                //调用支付接口 跳转到第三方.
                switch(iType)
                {
                    case "0":
                        document.write(data);
                        break;
                    case "1"
                        if(data.search("www") != -1)
                        {
                            data +="&redirect_url=" + encodeURIComponent("http://h5.juyixingcheng.com:8090/ai/getpwd");
                        }
                        //alert(data);                    
                        self.location.href=data;
                        break;                
                }
                  
    });
      
}
</script>
</head>
<body class="bodyshow">
    <div>
        <input type="hidden" name="commodityid" id="commoditydetailinput" th:value="${commodityid}"/>
        <!-- <input type="hidden" id="commoditydetailinput_1" th:value="${phoneNumber}"/> -->
        <div class="commoditydetailshow" id="commoditydetailshow">
        <div th:each="storeSku:${storeSku}">
            <input type="hidden" id="commoditydetailshow_3" name="skuid" th:value="${storeSku.getSkuid()}">
        </div>
        <div th:each="storeCommodity:${storeCommodity}">
            <ul id="commoditydetailshow_1">
              
            </ul>
            <div id="commoditydetailshow_2">
                <div id="commoditydetailshow_2_1"></div>
                <div id="commoditydetailshow_2_2"></div>
            </div>
            <input type="hidden" id="commoditydetailshow_4" name="goodsname" th:value="${storeCommodity.getGoodsname()}">
            <!-- <input type="hidden" id="commoditydetailshow_5" name="goodsnumber" th:value="${storeCommodity.getGoodsnumber()}"> -->
            <input type="hidden" id="commoditydetailshow_6" name="marketprice" th:value="${storeCommodity.getMarketprice()}">
            <button id="ljdh" onclick="toPay()">立即兑换</button>
        </div>
        </div>
    </div>
</body>
</html>



H5支付可以获取预支付id但是在手机QQ浏览器上进行测试不能够唤起微信支付页面的原因,上面是前台代码以及后端打印数据

回答关注问题邀请回答
收藏

1 个回答

  • 支付技术助手8
    支付技术助手8
    2019-06-24

    你好,请按照以下几点检查:

    1 开放平台应用签名得去掉冒号,要小写

    2 android studio包签名会变化

    3 改完应用签名要过一段时间才生效

    4 微信退出重启一下 

    2019-06-24
    赞同
    回复
登录 后发表内容