微赞平台拼团插件的支付流程

最终支付的是页面是
vzan/payment/wechat/pay.php第73行
$wOpt = wechat_build($params, $wechat);构造向腾讯发送的参数,并在本地页面调用支付的JS

参数的传递是由url(‘mc/cash/wechat’);这个地址传送过来的,传递的规则是ps中放的是订单的参数
$sl = base64_encode(json_encode($ps));
$auth = sha1($sl . $_W[‘uniacid’] . $_W[‘config’][‘setting’][‘authkey’]);
header(“location: ../payment/wechat/pay.php?i={$_W[‘uniacid’]}&auth={$auth}&ps={$sl}”);
url(‘mc/cash/wechat’)起的是支付中转的作用,将不同的支付方式转到相应的.php中,进行处理,对应的文件就是
vzan/app/source/mc/cash.ctrl.php
微信的支付大约是在第150行左右

那么如何进行跳转呢,具体的实现是在paycenter这个文件中,执行文件site.php,大约是在第111行中protected function pay

{if !empty($pay[‘wechat’][‘switch’])}

<div class=”pay-btn” id=”wechat-panel”>
<form action=”{php echo url(‘mc/cash/wechat’);}” method=”post”>
<input type=”hidden” name=”params” value=”{php echo base64_encode(json_encode($params));}” />
<input type=”hidden” name=”encrypt_code” value=”” />
<input type=”hidden” name=”card_id” value=”{php echo base64_encode($card_id);}” />
<input type=”hidden” name=”coupon_id” value=”” />
<button class=”btn btn-success btn-block col-sm-12″ disabled=”disabled” type=”submit” id=”wBtn” value=”wechat” style=”height: 42px; font-size: 18px;”>微信支付(必须使用微信内置浏览器)</button>
</form>
</div>
<script type=”text/JavaScript”>
document.addEventListener(‘WeixinJSBridgeReady’, function onBridgeReady() {
$(‘#wBtn’).removeAttr(‘disabled’);
$(‘#wBtn’).html(‘微信支付’);
});
</script>
{/if}

由谁来引导到支付中心的页面的呢?是由订单确认来引导向这个页面的,具体的实现原理是这样的
执行文件:orderconfirm.php,
模板文件:include $this->template(‘confirm’);
页面提交到site.php后,检查是否是提交信息,如果是提交信息,
转到下面的url:header(“location: ” .  $this->createMobileUrl(‘pay’, array(‘orderid’ => $orderid)));
之前的页面由order.php来完成

赞(0) 打赏
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏