WeChat JSAPI weixin Error "appidget_brand_wcpay_request"

491 views Asked by At

I am integrating my official Website page with wechat. I am building my backend in Asp.Net MVC. I am using JsApi for payment. When i click pay button . i saw small black wechat processing icon,after that i get an error code

appidget_brand_wcpay_request

Here is my html page

<script type="text/javascript">

//调用微信JS api 支付
function jsApiCall() {
    $.get("/RenewPay/GetData", null, function (data) {

        WeixinJSBridge.invoke('getBrandWCPayRequest', data, function (res) {
            WeixinJSBridge.log(res.err_msg);
           alert(res.err_code + res.err_desc + res.err_msg);
        });
    });
}

function callpay() {
    if (typeof (WeixinJSBridge) == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
        }
        else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', jsApiCall);
            document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
        }
    }
    else {
        jsApiCall();
    }
}

<a href="#" class="btn btn-primary" onclick="callpay()"> Pay Now </a>

Here is my official account setup for jsapi enter image description here

Help me!

2

There are 2 answers

0
ZeroNight On

WechatAuthorizationPlatform have an anthorize list , in this list , you should distinguish a/A , don't use capital(A), and an importanthis thing is you must sure WechatAuthorizationPlatform's url equals your own url , is my problem , hope it can help you.

enter image description here

0
clark yu On

use the method in latest jssdk.

  1. load js source '//res.wx.qq.com/open/js/jweixin-1.1.0.js'
  2. init wx object. wx.config({ /* ... */ });
  3. call 'wx.chooseWXPay'

    wx.chooseWXPay({ timestamp: params.timeStamp, nonceStr: params.nonceStr, package: params.package, signType: params.signType, paySign: params.paySign }, function(res) { if (res.err_msg == "get_brand_wcpay_request:ok") { alert('done'); } else { alert(res.err_code + "\n" + res.err_desc + "\n" + res.err_msg); } });