TanzCMS开源CMS系统

支付接入说明

订单支付模块依赖与模板写法

更新:2026-05-30 22:39:12 浏览:3

支付接入说明

一、作用

说明订单支付入口、支付渠道展示、发起支付和支付状态查询

二、模块要求

能力 依赖
创建订单 订单模块
余额支付 订单模块和会员资产
在线支付 支付模块
支付渠道 支付模块里的渠道配置
支付回调 支付模块

三、支付渠道循环

{loop $payment_channels $channel}
  <label>
    <input type="radio" name="channel_code" value="{$channel.code}">
    <span>{$channel.name}</span>
  </label>
{/loop}

四、渠道变量

变量 说明
$channel.code 支付渠道代码
$channel.name 支付渠道名称
$channel.enabled 是否可用

五、发起支付

<form action="/member/orders/{$order.order_no}/pay" method="post">
  <input type="hidden" name="_token" value="{$csrf}">
  <input type="hidden" name="channel_code" value="balance">
  <button type="submit">立即支付</button>
</form>

六、支付参数

字段 说明
channel_code 支付渠道代码
$order.order_no 订单号
$csrf CSRF Token

七、支付状态

fetch('/member/orders/' + orderNo + '/status', {
  headers: {'Accept': 'application/json'}
})

八、接入流程

  1. 启用订单模块
  2. 确认 0 元订单和余额支付流程
  3. 安装支付模块
  4. 配置支付渠道
  5. 测试发起支付、回调和订单状态