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

    use YansongdaPayPay;
    use YansongdaPayLog;

    $order = [
    'out_trade_no' => $out_trade_no,
    'body' => '代理开通',
    'total_fee' => $price,
    'openid' => $this->auth->getUser()->openid,
    ];
    $result = Pay::wechat(Config::get('wechat.pay'))->mp($order);

    function onBridgeReady() {
    WeixinJSBridge.invoke(
    'getBrandWCPayRequest', {
    "appId": "{$data.appId}", //公众号名称,由商户传入
    "timeStamp": "{$data.timeStamp}", //时间戳,自1970年以来的秒数
    "nonceStr": "{$data.nonceStr}", //随机串
    "package": "{$data.package}",
    "signType": "{$data.signType}", //微信签名方式:
    "paySign": "{$data.paySign}" //微信签名
    },
    function (res) {
    //alert(JSON.stringify(res));
    console.log(res)
    if (res.err_msg == "get_brand_wcpay_request:ok") {
    alert("支付成功!");
    location.href = successurl;
    } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
    alert("用户取消支付!");
    location.href = '{:url("paycancel")}';
    } else {
    alert("支付失败!");
    location.href = '{:url("payerror")}';
    }
    });
    }

    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();
    }

    $pay = Pay::wechat(Config::get('wechat.pay'));

    try {
    $data = $pay->verify(); // 是的,验签就这么简单!
    $return_data = $data->all();
    $pay_order_model = new appapimodelpayOrder;
    $order_mes = $pay_order_model->getOrderByPackage($return_data['out_trade_no']);
    } catch (Exception $e) {
    // $e->getMessage();
    }

    return $pay->success()->send();// laravel 框架中请直接 `return $pay->success()`


    https://gitee.com/yansongda/pay




  • 相关阅读:
    NGINX proxy_pass 域名解析问题
    NGINX源码分析——概览
    NGINX源代码自我总结(一)
    XWindow、Server、Client和QT、GTK之间的关系
    UBUNTU 字符界面来回切换
    ECshop 数据库表结构
    通读Cheerio文档
    Node.js 0.12: 正确发送HTTP POST请求
    npm配置镜像、设置代理
    配置 Windows 下的 nodejs C++ 模块编译环境 安装 node-gyp
  • 原文地址:https://www.cnblogs.com/daochong/p/10071491.html
Copyright © 2011-2022 走看看