zoukankan      html  css  js  c++  java
  • 微信JSAPI支付

    1.特别注意要二次签名,二次签名时appId,和一次签名时大小写问题。

    2.二次签名时随机串和时间戳重新生成。

    3.带着二次签名时的随机串和时间戳,统一下单时的prepay_id传递到前台。

    4.前台通过WeixinJSBridge.invoke()拉起支付

    WeixinJSBridge.invoke(
        'getBrandWCPayRequest',{
            "appId":appId,     //公众号名称,由商户传入
            "timeStamp":timeStamp, //时间戳,自1970年以来的秒数
            "nonceStr":nonceStr, //随机串
            "package":packageStr,  //预支付交易会话标识
            "signType":signType,   //微信签名方式
            "paySign":paySign         //微信签名
        },
        function(res){
            if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                //window.location.replace("index.html");
                alert('支付成功');
            }else if(res.err_msg == "get_brand_wcpay_request:cancel"){
                alert('支付取消');
            }else if(res.err_msg == "get_brand_wcpay_request:fail" ){
                alert('支付失败');
            }
            //使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回    ok,但并不保证它绝对可靠。
        }
    );
    调起微信支付
    博客园:https://www.cnblogs.com/xianquan
    Copyright ©2020 l-coil
    【转载文章务必保留出处和署名,谢谢!】
查看全文
  • 相关阅读:
    hash_map和map的区别
    STL中map与hash_map容器的选择收藏
    ServletContextListener和ContextLoaderListener的区别
    解决Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
    详解Tomcat线程池原理及参数释义
    Tomcat使用线程池配置高并发连接
    详解 Tomcat 的连接数与线程池
    ServletContextListener接口用法
    Spring Quartz定时任务如何获得ServletContext对象?
    如何在spring quartz类中拿到ServletContext
  • 原文地址:https://www.cnblogs.com/xianquan/p/12369279.html
  • Copyright © 2011-2022 走看看