POST:/Wechat/Pay/PayJSAPI
参数:
{
"oc_code":"橙云中台中配置的账户Code",
"orderNo":"订单号",
"totalFee":订单金额(元),
"orderSubject":"订单名称",
"orderBody":"订单描述",
"showUrl":"展示地址",
"returnUrl":"同步地址",
"merchantUrl":"用户中途返回商户的地址",
"orderAttach":"附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据",
"goodsTag":"商品标记,代金券或立减优惠功能的参数",
"sceneInfo":"该字段用于上报支付的场景信息,针对H5支付有以下三种场景,请根据对应场景上报,H5支付不建议在APP端使用,针对场景1,2请接入APP支付,不然可能会出现兼容性问题"
}
-- sceneInfo - 例:
//IOS移动应用
{"h5_info": {"type":"IOS","app_name": "王者荣耀","bundle_id": "com.tencent.wzryIOS"}}
//安卓移动应用
{"h5_info": {"type":"Android","app_name": "王者荣耀","package_name": "com.tencent.tmgp.sgame"}}
//WAP网站应用
{"h5_info": {"type":"Wap","wap_url": "https://pay.qq.com","wap_name": "腾讯充值"}}
返回:
{
"message": "成功",
"code": 1,
"value": {
"errcode":0,
"errmsg":"OK",
"jsApiParameters":"唤起支付用json字符串",
}
}
前端使用:
<script>
function jsApiCall()
{
WeixinJSBridge.invoke(
'getBrandWCPayRequest',
@Html.Raw(ViewBag.jsApiParameters), //唤起支付用json字符串
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();
}
}
callpay();
</script>