微信H5支付,前端HTML代码

说明
test是服务器地址,createH5Order接口要调用微信的统一下单接口,并返回微信返回的mwebUrl。

<html>
<body>
    <input type="button" onclick="doPay()" value="服务端统一下单接口">  </input>
</body>

<script >
    function doPay() {
        $.ajax({
            method: "GET",
            url: "https://test/pay/createH5Order/12345678",
            success: function(data){
                console.log(data)
                window.location.href = data.mwebUrl;
            }
        });
    }
</script>
<script src="jquery.js">
</script>
</html>

更多推荐

微信H5支付,HTML页面代码