[视频] 现象如图所示,支付完成后点击"完成"按钮后,会退出微信浏览器。
JSAPI支付成功后会闪退是为啥?JSAPI支付后回调函数,取消支付和支付失败会走,支付成功回调会闪退,请问这是什么原因? [图片]
2020-09-14请问楼主解决了么?我也遇到同样的问题。。。
微信jsapi支付闪退[代码]<%@page import="com.xteam.wechat.utils.Constant"%>[代码][代码]<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>[代码][代码]<%[代码][代码] [代码][代码]String path = request.getContextPath();[代码][代码] [代码][代码]String basePath = request.getScheme() + "://"[代码][代码] [代码][代码]+ request.getServerName() + ":" + request.getServerPort()[代码][代码] [代码][代码]+ path + "/";[代码][代码]%>[代码][代码]<!DOCTYPE html>[代码][代码]<[代码][代码]html[代码][代码]>[代码][代码]<[代码][代码]head[代码][代码]>[代码][代码]<[代码][代码]meta[代码] [代码]charset[代码][代码]=[代码][代码]"utf-8"[代码][代码]>[代码][代码]<[代码][代码]meta[代码] [代码]content[代码][代码]=[代码][代码]"width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"[代码] [代码]name[代码][代码]=[代码][代码]"viewport"[代码][代码]>[代码][代码]<[代码][代码]meta[代码] [代码]content[代码][代码]=[代码][代码]"yes"[代码] [代码]name[代码][代码]=[代码][代码]"apple-mobile-web-app-capable"[代码][代码]>[代码][代码]<[代码][代码]meta[代码] [代码]content[代码][代码]=[代码][代码]"black"[代码] [代码]name[代码][代码]=[代码][代码]"apple-mobile-web-app-status-bar-style"[代码][代码]>[代码][代码]<[代码][代码]meta[代码] [代码]content[代码][代码]=[代码][代码]"telephone=no"[代码] [代码]name[代码][代码]=[代码][代码]"format-detection"[代码][代码]>[代码][代码]<[代码][代码]meta[代码] [代码]content[代码][代码]=[代码][代码]"email=no"[代码] [代码]name[代码][代码]=[代码][代码]"format-detection"[代码][代码]>[代码][代码]<[代码][代码]link[代码] [代码]rel[代码][代码]=[代码][代码]"stylesheet"[代码] [代码]href="<%=basePath %>resource/css/wepayui/wepayui.min.css">[代码][代码]<[代码][代码]link[代码] [代码]rel[代码][代码]=[代码][代码]"stylesheet"[代码] [代码]href="<%=basePath %>resource/css/wepayui/index.css">[代码][代码]<[代码][代码]script[代码] [代码]type[代码][代码]=[代码][代码]"text/javascript"[代码] [代码]src="<%=path%>/resource/js/jquery-1.11.1.min.js"></[代码][代码]script[代码][代码]>[代码][代码]<[代码][代码]script[代码] [代码]type[代码][代码]=[代码][代码]"text/javascript"[代码] [代码]src="<%=path%>/resource/js/common/common.js"></[代码][代码]script[代码][代码]>[代码][代码]<[代码][代码]style[代码] [代码]type[代码][代码]=[代码][代码]"text/css"[代码][代码]>[代码][代码].advertising {[代码][代码] [代码][代码]display: none;[代码][代码] [代码][代码]width: 90%;[代码][代码] [代码][代码]margin: 30px auto;[代码][代码] [代码][代码]border: none;[代码][代码] [代码][代码]border-top: 1px dashed #6E6E6E;[代码][代码]}[代码] [代码].advertising img{[代码][代码] [代码][代码]width: 100%;[代码][代码] [代码][代码]margin-top: 20px;[代码][代码]}[代码][代码]</[代码][代码]style[代码][代码]>[代码][代码]<[代码][代码]title[代码][代码]>支付详情</[代码][代码]title[代码][代码]>[代码][代码]</[代码][代码]head[代码][代码]>[代码][代码]<!-- [代码][代码] [代码][代码]通用说明: [代码][代码] [代码][代码]1.模块的隐藏添加class:hide;[代码][代码] [代码][代码]2.body标签默认绑定ontouchstart事件,激活所有按钮的:active效果[代码][代码]-->[代码][代码]<[代码][代码]body[代码][代码]>[代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details__hd"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details__state"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]h2[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details__title"[代码][代码]><[代码][代码]i[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details__icon weui-icon-success"[代码][代码]></[代码][代码]i[代码][代码]>待缴费</[代码][代码]h2[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]p[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details__desc"[代码][代码]>¥${totalFee }</[代码][代码]p[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details__bd"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail__bd"[代码][代码]>单号:</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail__ft"[代码][代码]>${outOrderNo }</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail__bd"[代码][代码]>时间:</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail__ft"[代码][代码]>${ctime }</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail__bd"[代码][代码]>内容:</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-detail__ft weui_wepay_flex"[代码][代码]>${body }</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]div[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-details__ft"[代码] [代码]id[代码][代码]=[代码][代码]"submitbtn"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]input[代码] [代码]type[代码][代码]=[代码][代码]"button"[代码] [代码]class[代码][代码]=[代码][代码]"weui-btn weui-btn_primary"[代码] [代码]onclick[代码][代码]=[代码][代码]"submitPay();"[代码] [代码]value[代码][代码]=[代码][代码]"立即缴费"[代码][代码]/>[代码][代码] [代码][代码]</[代码][代码]div[代码][代码]>[代码][代码]</[代码][代码]div[代码][代码]>[代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"advertising"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]a[代码] [代码]href[代码][代码]=[代码][代码]"https://es.dmbcdn.com/m/product-mix/808186f8-3001-4066-9898-5d00bdde2486/intro?workid=BS66010915001316&tel=13320298866&name=%E5%BE%90%E5%90%AF%E4%BC%A6&company=%E4%B8%AD%E5%9B%BD%E4%BA%BA%E5%AF%BF%E4%BF%9D%E9%99%A9%E8%82%A1%E4%BB%BD%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8"[代码][代码]><[代码][代码]img[代码] [代码]src[代码][代码]=[代码][代码]"https://o6qs4vfhc.qnssl.com/ip1_1501227989332_1025?imageView2/3/w/828/h/340/format/jpg/interlace/1/q/90"[代码] [代码]/></[代码][代码]a[代码][代码]>[代码][代码]</[代码][代码]div[代码][代码]>[代码][代码]<[代码][代码]div[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-logos weui-wepay-logos_ft"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]i[代码] [代码]class[代码][代码]=[代码][代码]"weui-wepay-logo-default weui-wepay-logo_gray"[代码] [代码]style[代码][代码]=[代码][代码]"font-size: 16px;"[代码][代码]><[代码][代码]span[代码] [代码]class[代码][代码]=[代码][代码]"path1"[代码][代码]></[代码][代码]span[代码][代码]><[代码][代码]span[代码] [代码]class[代码][代码]=[代码][代码]"path2"[代码][代码]></[代码][代码]span[代码][代码]></[代码][代码]i[代码][代码]>[代码][代码]</[代码][代码]div[代码][代码]>[代码][代码]</[代码][代码]body[代码][代码]>[代码][代码]<[代码][代码]script[代码] [代码]type[代码][代码]=[代码][代码]"text/javascript"[代码] [代码]src[代码][代码]=[代码][代码]"http://res.wx.qq.com/open/js/jweixin-1.0.0.js"[代码][代码]></[代码][代码]script[代码][代码]>[代码][代码]<[代码][代码]script[代码] [代码]type[代码][代码]=[代码][代码]"text/javascript"[代码][代码]>[代码][代码] [代码][代码]//此处禁止用户点击返回按钮[代码][代码] [代码][代码]Common.stopBack("微信安全支付",null, WeixinJSBridge.call("closeWindow"));[代码] [代码] [代码][代码]function onBridgeReady(){[代码][代码] [代码][代码]WeixinJSBridge.invoke([代码][代码] [代码][代码]'getBrandWCPayRequest', ${payInfo},[代码][代码] [代码][代码]function(res){[代码][代码] [代码][代码]$("#submitbtn").css("display","none");[代码][代码] [代码][代码]if(res.err_msg == "get_brand_wcpay_request:ok" ) {// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok,但并不保证它绝对可靠。[代码][代码] [代码][代码]window.location.replace("${backUrl}");[代码][代码] [代码][代码]} [代码][代码] [代码][代码]}[代码][代码] [代码][代码]); [代码][代码] [代码][代码]}[代码][代码] [代码][代码]function submitPay(){[代码][代码] [代码][代码]if (typeof WeixinJSBridge == "undefined"){[代码][代码] [代码][代码]if( document.addEventListener ){[代码][代码] [代码][代码]document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);[代码][代码] [代码][代码]}else if (document.attachEvent){[代码][代码] [代码][代码]document.attachEvent('WeixinJSBridgeReady', onBridgeReady); [代码][代码] [代码][代码]document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}else{[代码][代码] [代码][代码]onBridgeReady();[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码]</[代码][代码]script[代码][代码]>[代码][代码]</[代码][代码]html[代码][代码]>[代码] 小部分用户进入支付页面就微信公众号闪退了
2020-09-14请问楼主解决了么?我也遇到同样的问题
JSAPI支付微信内H5调起,成功后不会返回支付状态,支付取消会返回支付状态 ,[代码]WeixinJSBridge.invoke([代码][代码] [代码][代码]'getBrandWCPayRequest'[代码][代码], payRes.content.payData, [代码][代码]function[代码][代码](res){[代码][代码] [代码][代码]if[代码][代码](res.err_msg == [代码][代码]"get_brand_wcpay_request:ok"[代码] [代码]){[代码][代码] //[代码][代码]Toast([代码][代码]'支付成功'[代码][代码])[代码][代码] [代码][代码]this[代码][代码].callBackOrder(payParam)[代码][代码] [代码][代码]}[代码][代码]else[代码] [代码]if[代码][代码](res.err_msg == [代码][代码]"get_brand_wcpay_request:cancel"[代码][代码]){[代码][代码] //[代码][代码]Toast([代码][代码]'支付取消'[代码][代码])[代码][代码] [代码][代码]}[代码][代码]else[代码] [代码]{[代码][代码] //[代码][代码]Toast(res.err_msg)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码] 这是实际实现代码 当我调起支付后 取消支付会执行 "支付取消" 处的代码,但支付成功后不会执行 "支付成功"处的代码 求解
2020-09-14