1. 维护代码健壮

2. 更新项目结构文档
This commit is contained in:
技术老胡
2026-04-27 16:20:41 +08:00
parent 9a16a88640
commit 0e5de50337
198 changed files with 21038 additions and 702 deletions

21
doc/api/README.md Normal file
View File

@@ -0,0 +1,21 @@
# 接口总说明
接口按消费方和协议分组,真实路由以 `mpay/app/route/*.php` 为准。
## 当前路由面
| 路由 | 用途 | 文档 |
| --- | --- | --- |
| `/adminapi` | 管理后台接口 | [admin.md](./admin.md) |
| `/merapi` | 商户后台接口 | [mer.md](./mer.md) |
| `/api/cashier` | 收银台前端 JSON 接口 | [cashier.md](./cashier.md) |
| `/api/pay``/api/merchant``/api/transfer` | ePay V2 / 开放 API | [cashier.md](./cashier.md)、[legacy/epay.md](./legacy/epay.md) |
| `/submit.php``/mapi.php``/api.php` | ePay V1 兼容入口 | [legacy/epay.md](./legacy/epay.md) |
## 通用约束
- HTTP 成功态使用 `200`
- 业务成功由响应体 `code=200` 表示。
- 后台类接口通过登录 token 鉴权。
- 开放支付接口通过商户 API 凭证和 ePay 签名规则鉴权。
- 接口字段不要在总文档重复铺开,按具体协议文档或控制器/校验器查看。

38
doc/api/admin.md Normal file
View File

@@ -0,0 +1,38 @@
# 管理后台接口
`admin` 前端调用 `/adminapi`,接口定义在 `mpay/app/route/admin.php`
## 基本信息
- 页面入口:`/admin`
- API 前缀:`/adminapi`
- 登录接口:`POST /login`
- 保护接口:`AdminAuthMiddleware`
- 前端封装:`admin/src/api/modules/*`
## 模块速览
| 模块 | 主要路径 |
| --- | --- |
| 认证 | `/login``/logout``/user/profile` |
| 管理员 | `/admin-users` |
| 商户 | `/merchants``/merchants/{id}/overview``/merchants/{id}/reset-password``/merchants/{id}/issue-credential` |
| 商户 API 凭证 | `/merchant-api-credentials` |
| 商户分组与策略 | `/merchant-groups``/merchant-policies` |
| 支付方式 | `/payment-types` |
| 支付插件 | `/payment-plugins``/payment-plugins/refresh``/payment-plugins/{code}/schema` |
| 插件配置 | `/payment-plugin-confs` |
| 支付通道 | `/payment-channels``/payment-channels/route-options` |
| 轮询组 | `/payment-poll-groups``/payment-poll-group-channels``/payment-poll-group-binds` |
| 路由预览 | `/routes/resolve` |
| 文件资产 | `/file-asset``/file-asset/upload``/file-asset/import-remote``/file-asset/{id}/preview``/file-asset/{id}/download` |
| 交易 | `/pay-orders``/refund-orders``/refund-orders/{refundNo}/retry``/settlement-orders` |
| 资金 | `/merchant-accounts``/merchant-accounts/summary``/account-ledgers` |
| 运维 | `/channel-daily-stats``/channel-notify-logs``/pay-callback-logs``/merchant-notify-tasks``/merchant-notify-tasks/{notifyNo}/retry` |
| 系统 | `/system/menu-tree``/system/dict-items``/system-config-pages` |
## 关联代码
- 控制器:`mpay/app/http/admin/controller`
- 校验器:`mpay/app/http/admin/validation`
- 前端接口:`admin/src/api/modules`

42
doc/api/cashier.md Normal file
View File

@@ -0,0 +1,42 @@
# 收银台与开放接口
本文覆盖 `cashier` 前端使用的收银台接口,以及后端在 `/api` 下暴露的 ePay V2 / 开放接口。
## 页面入口
| 页面前缀 | 说明 |
| --- | --- |
| `/cashier` | 收银台首页和业务单入口 |
| `/payment` | 支付页、中转页、结果页 |
后端在 `mpay/app/route/api.php` 中读取 `public/cashier/index.html` 返回前端入口。
## 收银台 JSON API
| 方法 | 路径 | 说明 |
| --- | --- | --- |
| `GET` | `/api/cashier/context` | 根据 `biz_no` 获取收银台上下文 |
| `POST` | `/api/cashier/confirm` | 确认支付,参数包含 `biz_no` 和支付类型 |
| `GET` | `/api/cashier/pay-order` | 根据 `pay_no` 获取支付单详情 |
对应前端封装:`cashier/src/api/cashier.ts`。对应后端控制器:`CashierController`
## ePay V2 / 开放 API
| 分组 | 方法与路径 |
| --- | --- |
| 支付 | `ANY /api/pay/submit``POST /api/pay/create``POST /api/pay/query``POST /api/pay/refund``POST /api/pay/refundquery``POST /api/pay/close``ANY /api/pay/{payNo}/callback` |
| 商户 | `POST /api/merchant/info``POST /api/merchant/orders` |
| 转账 | `POST /api/transfer/submit``POST /api/transfer/query``POST /api/transfer/balance` |
对应控制器:`EpayV2Controller`。签名与参数以 [ePay 兼容协议](./legacy/epay.md) 和校验器为准。
## ePay V1 兼容入口
| 方法 | 路径 | 说明 |
| --- | --- | --- |
| `ANY` | `/submit.php` | 页面跳转支付 |
| `POST` | `/mapi.php` | 接口支付 |
| `ANY` | `/api.php` | 标准 API |
对应控制器:`EpayV1Controller`

14
doc/api/legacy/epay.md Normal file
View File

@@ -0,0 +1,14 @@
# ePay 兼容协议归档
这里是 ePay 兼容协议的总入口索引。
## 版本列表
- [ePay V1 文档](./epay_v1.md)
- [ePay V2 文档](./epay_v2.md)
## 说明
- `epay_v1.md` 对应原站点旧版 `doc_old.html`,协议以 `MD5` 为主。
- `epay_v2.md` 对应原站点新版 `doc/index.html`,协议以 `RSA` 为主。
- 其他文档仍可继续引用这个索引页,避免入口分散。

332
doc/api/legacy/epay_v1.md Normal file
View File

@@ -0,0 +1,332 @@
# ePay V1 接口文档整理
> 本文件整理自原版文档 [https://epay.qcjy.cc/doc_old.html](https://epay.qcjy.cc/doc_old.html)
>
> 用途:作为 V1 兼容层和老接口迁移时的协议参考,不包含本项目当前实现细节。
## 1. 协议规则
| 项目 | 值 |
| --- | --- |
| 请求数据格式 | `application/x-www-form-urlencoded` |
| 返回数据格式 | `JSON` |
| 签名算法 | `MD5` |
| 字符编码 | `UTF-8` |
## 2. 接口总览
| 入口 | 说明 |
| --- | --- |
| `submit.php` | 页面跳转支付 |
| `mapi.php` | API 接口支付 |
| `api.php?act=query` | 查询商户信息 |
| `api.php?act=settle` | 查询结算记录 |
| `api.php?act=order` | 查询单个订单 |
| `api.php?act=orders` | 批量查询订单 |
| `api.php?act=refund` | 提交订单退款 |
## 3. 页面跳转支付
### 3.1 接口说明
- 用途:用户前台直接发起支付
- 常见调用方式:`form` 表单提交,或拼成跳转链接
- URL`http://epay.qcjy.cc/submit.php`
- 请求方式:`POST``GET`
- 推荐方式:`POST`
- `type` 不传时,默认进入收银台流程
### 3.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 支付方式 | `type` | 否 | `String` | `alipay` | 支付方式列表 |
| 商户订单号 | `out_trade_no` | 是 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 异步通知地址 | `notify_url` | 是 | `String` | `http://www.pay.com/notify_url.php` | 服务器异步通知地址 |
| 跳转通知地址 | `return_url` | 是 | `String` | `http://www.pay.com/return_url.php` | 页面跳转通知地址 |
| 商品名称 | `name` | 是 | `String` | `VIP会员` | 超过 127 个字节会自动截取 |
| 商品金额 | `money` | 是 | `String` | `1.00` | 单位:元,最多 2 位小数 |
| 业务扩展参数 | `param` | 否 | `String` | `没有请留空` | 支付后原样返回 |
| 签名字符串 | `sign` | 是 | `String` | `202cb962ac59075b964b07152d234b70` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `MD5` | 默认为 `MD5` |
### 3.3 说明
- `notify_url` 用于异步通知
- `return_url` 用于支付完成后的前端跳转
- `param` 会在支付完成后原样返回
## 4. API 接口支付
### 4.1 接口说明
- 用途:服务器后端发起支付请求
- URL`http://epay.qcjy.cc/mapi.php`
- 请求方式:`POST`
- 响应通常返回跳转链接、二维码链接或小程序跳转链接中的一种
### 4.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 支付方式 | `type` | 是 | `String` | `alipay` | 支付方式列表 |
| 商户订单号 | `out_trade_no` | 是 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 异步通知地址 | `notify_url` | 是 | `String` | `http://www.pay.com/notify_url.php` | 服务器异步通知地址 |
| 跳转通知地址 | `return_url` | 否 | `String` | `http://www.pay.com/return_url.php` | 页面跳转通知地址 |
| 商品名称 | `name` | 是 | `String` | `VIP会员` | 超过 127 个字节会自动截取 |
| 商品金额 | `money` | 是 | `String` | `1.00` | 单位:元,最多 2 位小数 |
| 用户IP地址 | `clientip` | 是 | `String` | `192.168.1.100` | 用户发起支付的 IP |
| 设备类型 | `device` | 否 | `String` | `pc` | 根据 UA 判断,默认 `pc` |
| 业务扩展参数 | `param` | 否 | `String` | `没有请留空` | 支付后原样返回 |
| 签名字符串 | `sign` | 是 | `String` | `202cb962ac59075b964b07152d234b70` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `MD5` | 默认为 `MD5` |
### 4.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `1` | `1` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | | 失败时返回原因 |
| 订单号 | `trade_no` | `String` | `20160806151343349` | 支付订单号 |
| 支付跳转url | `payurl` | `String` | `http://epay.qcjy.cc/pay/wxpay/202010903/` | 直接跳转该 URL 支付 |
| 二维码链接 | `qrcode` | `String` | `weixin://wxpay/bizpayurl?pr=04IPMKM` | 按链接生成二维码 |
| 小程序跳转url | `urlscheme` | `String` | `weixin://dl/business/?ticket=xxx` | 使用 JS 跳转该 URL |
### 4.4 说明
- `payurl``qrcode``urlscheme` 三者只会返回其中一个
- `device` 和支付方式会影响最终返回值类型
- 返回值为 JSON由调用方自行决定跳转、展示二维码或拉起小程序
## 5. 支付结果通知
### 5.1 通知类型
- 服务器异步通知:`notify_url`
- 页面跳转通知:`return_url`
### 5.2 请求方式
- `GET`
### 5.3 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 易支付订单号 | `trade_no` | 是 | `String` | `20160806151343349021` | 平台订单号 |
| 商户订单号 | `out_trade_no` | 是 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 支付方式 | `type` | 是 | `String` | `alipay` | 支付方式列表 |
| 商品名称 | `name` | 是 | `String` | `VIP会员` | 商品名称 |
| 商品金额 | `money` | 是 | `String` | `1.00` | 商品金额 |
| 支付状态 | `trade_status` | 是 | `String` | `TRADE_SUCCESS` | 只有 `TRADE_SUCCESS` 才表示成功 |
| 业务扩展参数 | `param` | 否 | `String` | | 业务参数 |
| 签名字符串 | `sign` | 是 | `String` | `202cb962ac59075b964b07152d234b70` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `MD5` | 默认为 `MD5` |
### 5.4 回调响应
- 收到异步通知后,需返回 `success`
- 页面跳转通知主要用于前端展示,不代表后台最终确认逻辑
## 6. MD5 签名算法
1. 将发送或接收到的所有参数按照参数名 ASCII 码从小到大排序。
2. `sign``sign_type` 和空值不参与签名。
3. 将排序后的参数拼接成 `a=b&c=d&e=f` 的形式,参数值不要进行 URL 编码。
4. 将拼接字符串与商户密钥 `KEY` 进行 MD5 加密,得到签名。
```text
sign = md5(a=b&c=d&e=f + KEY)
```
说明:
- `+` 代表字符串拼接,不是字符本身
- MD5 结果为小写
- 具体示例以 SDK 为准
## 7. 支付方式列表
| 调用值 | 描述 |
| --- | --- |
| `alipay` | 支付宝 |
| `wxpay` | 微信支付 |
| `qqpay` | QQ 钱包 |
## 8. 设备类型列表
| 调用值 | 描述 |
| --- | --- |
| `pc` | 电脑浏览器 |
| `mobile` | 手机浏览器 |
| `qq` | 手机 QQ 内浏览器 |
| `wechat` | 微信内浏览器 |
| `alipay` | 支付宝客户端 |
| `jump` | 仅返回支付跳转 URL |
## 9. [API]查询商户信息
### 9.1 接口说明
- URL`http://epay.qcjy.cc/api.php?act=query&pid={商户ID}&key={商户密钥}`
- 操作类型:`query`
### 9.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 操作类型 | `act` | 是 | `String` | `query` | 固定值 |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 商户密钥 | `key` | 是 | `String` | `89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i` | 商户密钥 |
### 9.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `1` | `1` 为成功,其它值为失败 |
| 商户ID | `pid` | `Int` | `1001` | 商户ID |
| 商户密钥 | `key` | `String(32)` | `89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i` | 商户密钥 |
| 商户状态 | `active` | `Int` | `1` | `1` 为正常,`0` 为封禁 |
| 商户余额 | `money` | `String` | `0.00` | 商户所拥有的余额 |
| 结算方式 | `type` | `Int` | `1` | `1:支付宝,2:微信,3:QQ,4:银行卡` |
| 结算账号 | `account` | `String` | `admin@pay.com` | 结算账号 |
| 结算姓名 | `username` | `String` | `张三` | 结算姓名 |
| 订单总数 | `orders` | `Int` | `30` | 订单总数统计 |
| 今日订单 | `order_today` | `Int` | `15` | 今日订单数量 |
| 昨日订单 | `order_lastday` | `Int` | `15` | 昨日订单数量 |
## 10. [API]查询结算记录
### 10.1 接口说明
- URL`http://epay.qcjy.cc/api.php?act=settle&pid={商户ID}&key={商户密钥}`
- 操作类型:`settle`
### 10.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 操作类型 | `act` | 是 | `String` | `settle` | 固定值 |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 商户密钥 | `key` | 是 | `String` | `89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i` | 商户密钥 |
### 10.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `1` | `1` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `查询结算记录成功!` | 提示信息 |
| 结算记录 | `data` | `Array` | 结算记录列表 | 结算记录数组 |
> 原版文档对 `data` 内部结构只给出“结算记录列表”的说明,没有展开逐字段定义。
## 11. [API]查询单个订单
### 11.1 接口说明
- URL`http://epay.qcjy.cc/api.php?act=order&pid={商户ID}&key={商户密钥}&out_trade_no={商户订单号}`
- 操作类型:`order`
### 11.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 操作类型 | `act` | 是 | `String` | `order` | 固定值 |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 商户密钥 | `key` | 是 | `String` | `89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i` | 商户密钥 |
| 系统订单号 | `trade_no` | 选择 | `String` | `20160806151343312` | 平台订单号 |
| 商户订单号 | `out_trade_no` | 选择 | `String` | `20160806151343349` | 商户自定义订单号 |
说明:
- `trade_no``out_trade_no` 二选一即可
- 如果都传入,以 `trade_no` 为准
### 11.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `1` | `1` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `查询订单号成功!` | 提示信息 |
| 易支付订单号 | `trade_no` | `String` | `2016080622555342651` | 平台订单号 |
| 商户订单号 | `out_trade_no` | `String` | `20160806151343349` | 商户系统内部订单号 |
| 第三方订单号 | `api_trade_no` | `String` | `20160806151343349` | 支付渠道订单号 |
| 支付方式 | `type` | `String` | `alipay` | 支付方式列表 |
| 商户ID | `pid` | `Int` | `1001` | 发起支付的商户ID |
| 创建订单时间 | `addtime` | `String` | `2016-08-06 22:55:52` | 创建时间 |
| 完成交易时间 | `endtime` | `String` | `2016-08-06 22:55:52` | 完成时间 |
| 商品名称 | `name` | `String` | `VIP会员` | 商品名称 |
| 商品金额 | `money` | `String` | `1.00` | 商品金额 |
| 支付状态 | `status` | `Int` | `0` | `1` 表示支付成功,`0` 表示未支付 |
| 业务扩展参数 | `param` | `String` | | 默认留空 |
| 支付者账号 | `buyer` | `String` | | 默认留空 |
## 12. [API]批量查询订单
### 12.1 接口说明
- URL`http://epay.qcjy.cc/api.php?act=orders&pid={商户ID}&key={商户密钥}`
- 操作类型:`orders`
### 12.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 操作类型 | `act` | 是 | `String` | `orders` | 固定值 |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 商户密钥 | `key` | 是 | `String` | `89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i` | 商户密钥 |
| 查询订单数量 | `limit` | 否 | `Int` | `20` | 返回订单数量,最大 `50` |
| 页码 | `page` | 否 | `Int` | `1` | 当前查询页码 |
### 12.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `1` | `1` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `查询结算记录成功!` | 提示信息 |
| 订单列表 | `data` | `Array` | 订单列表 | 订单数组 |
> `data` 中每一项与“查询单个订单”返回结构基本一致。
## 13. [API]提交订单退款
### 13.1 接口说明
- 需要先在商户后台开启订单退款 API 接口开关
- URL`http://epay.qcjy.cc/api.php?act=refund`
- 请求方式:`POST`
### 13.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 商户密钥 | `key` | 是 | `String` | `89unJUB8HZ54Hj7x4nUj56HN4nUzUJ8i` | 商户密钥 |
| 易支付订单号 | `trade_no` | 特殊可选 | `String` | `20160806151343349021` | 平台订单号 |
| 商户订单号 | `out_trade_no` | 特殊可选 | `String` | `20160806151343349` | 下单时传入的商户订单号 |
| 退款金额 | `money` | 是 | `String` | `1.50` | 少数通道需要与原订单金额一致 |
说明:
- `trade_no``out_trade_no` 不能同时为空
- 如果都传了,以 `trade_no` 为准
### 13.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `1` | `1` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `退款成功` | 提示信息 |
## 14. SDK 下载
- 下载地址:[`SDK.zip`](https://epay.qcjy.cc/assets/files/SDK.zip?_v=1.3)
- 版本:`V1.3`
## 15. 备注
- 原版文档页面还包含“产品”“关于我们”“联系我们”等站点导航内容,这里不做展开
- 如果需要继续对照更多说明,优先以原站点文档为准

518
doc/api/legacy/epay_v2.md Normal file
View File

@@ -0,0 +1,518 @@
# ePay V2 接口文档整理
> 本文件整理自原版文档 [https://epay.qcjy.cc/doc/index.html](https://epay.qcjy.cc/doc/index.html)
>
> 用途:作为 V2 兼容层和新接口迁移时的协议参考,不包含本项目当前实现细节。
## 1. 协议规则
| 项目 | 值 |
| --- | --- |
| 请求数据格式 | `application/x-www-form-urlencoded` |
| 返回数据格式 | `JSON` |
| 签名算法 | `SHA256WithRSA` |
| 字符编码 | `UTF-8` |
## 2. V2 升级说明
1. V2 全面使用 RSA 签名V1 保留 MD5 签名。
2. V2 改用新的接口地址,支持退款、代付等能力。
3. V2 增加 `timestamp` 参数和返回值,用于时间戳校验。
## 3. RSA 密钥对
- 在商户后台的 API 信息页面生成商户 RSA 密钥对。
- 商户需要妥善保管私钥。
- 对接时通常会同时使用平台公钥和商户私钥。
## 4. 签名规则
### 4.1 请求签名
1. 取所有非空参数。
2. 排除 `sign``sign_type`
3. 排除数组、文件、二进制等非普通字段。
4. 按参数名 ASCII 升序排序。
5.`k=v&k2=v2...` 的方式拼接原文。
6. 使用商户私钥进行 `SHA256WithRSA` 签名。
### 4.2 验签规则
1. 按相同规则整理原文。
2. 使用平台公钥验证签名。
3. 请求和响应都应做签名校验。
## 5. 支付方式列表
| 调用值 | 描述 |
| --- | --- |
| `alipay` | 支付宝 |
| `wxpay` | 微信支付 |
| `qqpay` | QQ 钱包 |
## 6. 设备类型列表
| 调用值 | 描述 |
| --- | --- |
| `pc` | 电脑浏览器 |
| `mobile` | 手机浏览器 |
| `qq` | 手机 QQ 内浏览器 |
| `wechat` | 微信内浏览器 |
| `alipay` | 支付宝客户端 |
## 7. 接口总览
| 入口 | 说明 |
| --- | --- |
| `submit.php` / `/api/pay/submit` | 页面跳转支付 |
| `/api/pay/create` | API 创建订单 |
| `/api/pay/query` | 查询订单 |
| `/api/pay/notify` | 支付结果通知 |
| `/api/pay/refund` | 退款 |
| `/api/pay/refundquery` | 退款查询 |
| `/api/pay/close` | 关闭订单 |
| `/api/merchant/info` | 查询商户信息 |
| `/api/merchant/orders` | 查询商户订单 |
| `/api/transfer/submit` | 提交转账 |
| `/api/transfer/query` | 查询转账 |
| `/api/transfer/balance` | 查询转账余额 |
## 8. 页面跳转支付
### 8.1 接口说明
- URL`http://epay.qcjy.cc/api/pay/submit`
- 用途:前台页面跳转支付
- 请求方式:`POST`
- `type` 可不传,不传时进入收银台
### 8.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 支付方式 | `type` | 否 | `String` | `alipay` | 支付方式列表 |
| 商户订单号 | `out_trade_no` | 是 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 异步通知地址 | `notify_url` | 是 | `String` | `http://www.pay.com/notify_url.php` | 异步通知地址 |
| 跳转通知地址 | `return_url` | 是 | `String` | `http://www.pay.com/return_url.php` | 页面跳转通知地址 |
| 商品名称 | `name` | 是 | `String` | `VIP会员` | 商品名称 |
| 商品金额 | `money` | 是 | `String` | `1.00` | 单位:元 |
| 业务扩展参数 | `param` | 否 | `String` | | 支付后原样返回 |
| 渠道ID | `channel_id` | 否 | `String` | `1001` | 指定支付渠道 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
## 9. API 创建订单
### 9.1 接口说明
- URL`http://epay.qcjy.cc/api/pay/create`
- 用途:服务器端统一创建订单
- 请求方式:`POST`
### 9.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 接口类型 | `method` | 是 | `String` | `web` | `web``jump``jsapi``app``scan``applet` |
| 设备类型 | `device` | 否 | `String` | `pc` | `pc``mobile``qq``wechat``alipay` |
| 支付方式 | `type` | 是 | `String` | `alipay` | 支付方式列表 |
| 商户订单号 | `out_trade_no` | 是 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 异步通知地址 | `notify_url` | 是 | `String` | `http://www.pay.com/notify_url.php` | 异步通知地址 |
| 跳转通知地址 | `return_url` | 否 | `String` | `http://www.pay.com/return_url.php` | 页面跳转通知地址 |
| 商品名称 | `name` | 是 | `String` | `VIP会员` | 商品名称 |
| 商品金额 | `money` | 是 | `String` | `1.00` | 单位:元 |
| 用户IP地址 | `clientip` | 否 | `String` | `127.0.0.1` | 用户发起支付的 IP |
| 业务扩展参数 | `param` | 否 | `String` | | 支付后原样返回 |
| 授权码 | `auth_code` | 否 | `String` | | JSAPI / 刷脸类场景使用 |
| 子用户 OPENID | `sub_openid` | 否 | `String` | | 微信相关场景使用 |
| 子应用 APPID | `sub_appid` | 否 | `String` | | 微信相关场景使用 |
| 渠道ID | `channel_id` | 否 | `String` | `1001` | 指定通道 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 9.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 平台订单号 | `trade_no` | `String` | `2016080622555342651` | 易支付订单号 |
| 返回类型 | `pay_type` | `String` | `qrcode` | 返回内容类型 |
| 支付内容 | `pay_info` | `Mixed` | | 跳转链接、二维码内容或 JSAPI 参数 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
### 9.4 `pay_type` 说明
| 值 | 说明 |
| --- | --- |
| `jump` | 跳转链接 |
| `html` | HTML 片段 |
| `qrcode` | 二维码内容 |
| `urlscheme` | 小程序 URL Scheme |
| `jsapi` | JSAPI 参数 |
| `app` | APP 调起参数 |
| `scan` | 扫码支付结果信息 |
| `wxplugin` | 小程序插件参数 |
| `wxapp` | APP 拉起小程序参数 |
## 10. 订单查询
### 10.1 接口说明
- URL`http://epay.qcjy.cc/api/pay/query`
- 请求方式:`POST`
### 10.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 平台订单号 | `trade_no` | 二选一 | `String` | `2016080622555342651` | 易支付订单号 |
| 商户订单号 | `out_trade_no` | 二选一 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 10.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 平台订单号 | `trade_no` | `String` | | 平台订单号 |
| 商户订单号 | `out_trade_no` | `String` | | 商户订单号 |
| 第三方订单号 | `api_trade_no` | `String` | | 渠道订单号 |
| 支付方式 | `type` | `String` | `alipay` | 支付方式 |
| 支付状态 | `status` | `Int` | `1` | `0` 未支付,`1` 已支付,`2` 已退款,`3` 已冻结,`4` 预授权 |
| 商户ID | `pid` | `Int` | `1001` | 商户ID |
| 创建时间 | `addtime` | `String` | `2016-08-06 22:55:52` | 创建时间 |
| 完成时间 | `endtime` | `String` | `2016-08-06 22:55:52` | 完成时间 |
| 商品名称 | `name` | `String` | `VIP会员` | 商品名称 |
| 商品金额 | `money` | `String` | `1.00` | 商品金额 |
| 退款金额 | `refundmoney` | `String` | `0.00` | 已退款金额 |
| 业务扩展参数 | `param` | `String` | | 扩展参数 |
| 支付者账号 | `buyer` | `String` | | 支付者账号 |
| 用户IP | `clientip` | `String` | | 下单 IP |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 11. 支付通知
### 11.1 通知类型
- 异步通知:`notify_url`
- 页面跳转通知:`return_url`
### 11.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 平台订单号 | `trade_no` | 是 | `String` | `2016080622555342651` | 易支付订单号 |
| 商户订单号 | `out_trade_no` | 是 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 支付方式 | `type` | 是 | `String` | `alipay` | 支付方式 |
| 支付状态 | `trade_status` | 是 | `String` | `TRADE_SUCCESS` | 成功状态固定为该值 |
| 创建时间 | `addtime` | 否 | `String` | `2016-08-06 22:55:52` | 创建时间 |
| 完成时间 | `endtime` | 否 | `String` | `2016-08-06 22:55:52` | 完成时间 |
| 商品名称 | `name` | 是 | `String` | `VIP会员` | 商品名称 |
| 商品金额 | `money` | 是 | `String` | `1.00` | 商品金额 |
| 业务扩展参数 | `param` | 否 | `String` | | 业务参数 |
| 支付者账号 | `buyer` | 否 | `String` | | 支付者账号 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 11.3 回调响应
- 收到异步通知后,返回 `success`
- 通知时要校验签名,并确认 `trade_status == TRADE_SUCCESS`
## 12. 退款
### 12.1 接口说明
- URL`http://epay.qcjy.cc/api/pay/refund`
- 请求方式:`POST`
### 12.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 平台订单号 | `trade_no` | 二选一 | `String` | `2016080622555342651` | 易支付订单号 |
| 商户订单号 | `out_trade_no` | 二选一 | `String` | `20160806151343349` | 商户系统内部订单号 |
| 退款金额 | `money` | 是 | `String` | `1.50` | 退款金额 |
| 商户退款单号 | `out_refund_no` | 否 | `String` | `R202604210001` | 商户侧退款流水号 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 12.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 退款单号 | `refund_no` | `String` | `202604210001` | 平台退款单号 |
| 商户退款单号 | `out_refund_no` | `String` | `R202604210001` | 商户退款单号 |
| 平台订单号 | `trade_no` | `String` | `2016080622555342651` | 易支付订单号 |
| 退款金额 | `money` | `String` | `1.50` | 退款金额 |
| 已退金额 | `reducemoney` | `String` | `1.50` | 累计退款金额 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 13. 退款查询
### 13.1 接口说明
- URL`http://epay.qcjy.cc/api/pay/refundquery`
- 请求方式:`POST`
### 13.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 退款单号 | `refund_no` | 二选一 | `String` | `202604210001` | 平台退款单号 |
| 商户退款单号 | `out_refund_no` | 二选一 | `String` | `R202604210001` | 商户退款单号 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 13.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 退款单号 | `refund_no` | `String` | `202604210001` | 平台退款单号 |
| 商户退款单号 | `out_refund_no` | `String` | `R202604210001` | 商户退款单号 |
| 平台订单号 | `trade_no` | `String` | `2016080622555342651` | 易支付订单号 |
| 商户订单号 | `out_trade_no` | `String` | `20160806151343349` | 商户订单号 |
| 退款金额 | `money` | `String` | `1.50` | 退款金额 |
| 已退金额 | `reducemoney` | `String` | `1.50` | 累计退款金额 |
| 退款状态 | `status` | `Int` | `1` | `0` 失败,`1` 成功 |
| 创建时间 | `addtime` | `String` | `2016-08-06 22:55:52` | 创建时间 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 14. 关闭订单
### 14.1 接口说明
- URL`http://epay.qcjy.cc/api/pay/close`
- 请求方式:`POST`
- 仅支持部分支付插件
### 14.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 平台订单号 | `trade_no` | 二选一 | `String` | `2016080622555342651` | 易支付订单号 |
| 商户订单号 | `out_trade_no` | 二选一 | `String` | `20160806151343349` | 商户订单号 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 14.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 15. 商户信息
### 15.1 接口说明
- URL`http://epay.qcjy.cc/api/merchant/info`
- 请求方式:`POST`
### 15.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 15.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 商户ID | `pid` | `Int` | `1001` | 商户ID |
| 商户状态 | `status` | `Int` | `1` | 商户状态 |
| 支付状态 | `pay_status` | `Int` | `1` | 支付开关 |
| 结算状态 | `settle_status` | `Int` | `1` | 结算开关 |
| 商户余额 | `money` | `String` | `0.00` | 可用余额 |
| 结算类型 | `settle_type` | `Int` | `1` | `1` 支付宝,`2` 微信,`3` QQ`4` 银行卡 |
| 结算账号 | `settle_account` | `String` | `admin@pay.com` | 结算账号 |
| 结算姓名 | `settle_name` | `String` | `张三` | 结算姓名 |
| 订单总数 | `order_num` | `Int` | `30` | 订单总数 |
| 今日订单 | `order_num_today` | `Int` | `15` | 今日订单数量 |
| 昨日订单 | `order_num_lastday` | `Int` | `15` | 昨日订单数量 |
| 今日交易额 | `order_money_today` | `String` | `100.00` | 今日交易金额 |
| 昨日交易额 | `order_money_lastday` | `String` | `90.00` | 昨日交易金额 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 16. 商户订单
### 16.1 接口说明
- URL`http://epay.qcjy.cc/api/merchant/orders`
- 请求方式:`POST`
### 16.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 偏移量 | `offset` | 否 | `Int` | `0` | 起始偏移 |
| 数量 | `limit` | 否 | `Int` | `20` | 返回条数 |
| 状态 | `status` | 否 | `Int` | `1` | 订单状态筛选 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 16.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 订单数据 | `data` | `Array` | 订单列表 | 订单数组 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 17. 转账提交
### 17.1 接口说明
- URL`http://epay.qcjy.cc/api/transfer/submit`
- 请求方式:`POST`
### 17.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 转账类型 | `type` | 是 | `String` | `alipay` | `alipay``wxpay``qqpay``bank` |
| 收款账号 | `account` | 是 | `String` | `admin@pay.com` | 收款账号 |
| 收款姓名 | `name` | 是 | `String` | `张三` | 收款姓名 |
| 金额 | `money` | 是 | `String` | `1.00` | 转账金额 |
| 备注 | `remark` | 否 | `String` | `测试转账` | 转账备注 |
| 商户转账单号 | `out_biz_no` | 否 | `String` | `T202604210001` | 商户侧流水号 |
| 书签 ID | `bookid` | 否 | `String` | `1` | 账本或预设项标识 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 17.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 转账状态 | `status` | `Int` | `0` | `0` 待处理,后续查询 |
| 平台业务号 | `biz_no` | `String` | `202604210001` | 平台转账业务号 |
| 商户转账单号 | `out_biz_no` | `String` | `T202604210001` | 商户侧流水号 |
| 订单号 | `orderid` | `String` | `202604210001` | 平台订单号 |
| 支付时间 | `paydate` | `String` | `2016-08-06 22:55:52` | 完成时间 |
| 手续费 | `cost_money` | `String` | `0.10` | 扣除费用 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 18. 转账查询
### 18.1 接口说明
- URL`http://epay.qcjy.cc/api/transfer/query`
- 请求方式:`POST`
### 18.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 平台业务号 | `biz_no` | 二选一 | `String` | `202604210001` | 平台转账业务号 |
| 商户转账单号 | `out_biz_no` | 二选一 | `String` | `T202604210001` | 商户侧流水号 |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 18.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 转账状态 | `status` | `Int` | `1` | `0` 处理中,`1` 成功,`2` 失败 |
| 错误信息 | `errmsg` | `String` | | 失败原因 |
| 平台业务号 | `biz_no` | `String` | `202604210001` | 平台转账业务号 |
| 商户转账单号 | `out_biz_no` | `String` | `T202604210001` | 商户侧流水号 |
| 订单号 | `orderid` | `String` | `202604210001` | 平台订单号 |
| 支付时间 | `paydate` | `String` | `2016-08-06 22:55:52` | 完成时间 |
| 金额 | `amount` | `String` | `1.00` | 转账金额 |
| 手续费 | `cost_money` | `String` | `0.10` | 扣除费用 |
| 备注 | `remark` | `String` | `测试转账` | 备注信息 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 19. 转账余额
### 19.1 接口说明
- URL`http://epay.qcjy.cc/api/transfer/balance`
- 请求方式:`POST`
### 19.2 请求参数
| 字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- | --- |
| 商户ID | `pid` | 是 | `Int` | `1001` | 商户ID |
| 时间戳 | `timestamp` | 是 | `String` | `1713660000` | 用于时间校验 |
| 签名字符串 | `sign` | 是 | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | 是 | `String` | `SHA256WithRSA` | 签名类型 |
### 19.3 返回结果
| 字段名 | 变量名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| 返回状态码 | `code` | `Int` | `0` | `0` 为成功,其它值为失败 |
| 返回信息 | `msg` | `String` | `success` | 提示信息 |
| 可用余额 | `available_money` | `String` | `100.00` | 可转账余额 |
| 转账费率 | `transfer_rate` | `String` | `0.01` | 转账费率 |
| 时间戳 | `timestamp` | `String` | `1713660000` | 返回时间戳 |
| 签名字符串 | `sign` | `String` | `...` | 签名结果 |
| 签名类型 | `sign_type` | `String` | `SHA256WithRSA` | 签名类型 |
## 20. SDK 下载
- 下载地址:[`SDK_2.0.zip`](https://epay.qcjy.cc/assets/files/SDK_2.0.zip)
- 版本:`V2.0`
## 21. 备注
- V2 文档页面还包含更细的接口说明、页面示例和菜单导航,这里只整理对接最关键的协议信息。
- 如果后续需要补充每个接口的示例请求与返回样例,可以继续在本目录补充,但建议保持版本归档方式一致。

View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>正在为您跳转到支付页面,请稍候...</title>
<style type="text/css">
body{margin:0;padding:0}
p{position:absolute;left:50%;top:50%;height:35px;margin:-35px 0 0 -160px;padding:20px;font:bold 16px/30px "宋体",Arial;text-indent:40px;border:1px solid #c5d0dc}
#waiting{font-family:Arial}
</style>
</head>
<body>
<?php
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
/**************************请求参数**************************/
$notify_url = "http://127.0.0.1/SDK/notify_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = "http://127.0.0.1/SDK/return_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//商户订单号
$out_trade_no = $_POST['WIDout_trade_no'];
//商户网站订单系统中唯一订单号,必填
//支付方式可传入alipay,wxpay,qqpay,bank,jdpay
$type = $_POST['type'];
//商品名称
$name = $_POST['WIDsubject'];
//付款金额
$money = $_POST['WIDtotal_fee'];
/************************************************************/
//构造要请求的参数数组,无需改动
$parameter = array(
"pid" => $epay_config['pid'],
"type" => $type,
"notify_url" => $notify_url,
"return_url" => $return_url,
"out_trade_no" => $out_trade_no,
"name" => $name,
"money" => $money,
);
//建立请求
$epay = new EpayCore($epay_config);
$html_text = $epay->pagePay($parameter);
echo $html_text;
?>
<p>正在为您跳转到支付页面,请稍候...</p>
</body>
</html>

View File

@@ -0,0 +1,205 @@
<?php
/* *
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>彩虹易支付接口测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
*{
margin:0;
padding:0;
}
ul,ol{
list-style:none;
}
.title{
color: #ADADAD;
font-size: 14px;
font-weight: bold;
padding: 8px 16px 5px 10px;
}
.hidden{
display:none;
}
.new-btn-login-sp{
border:1px solid #D74C00;
padding:1px;
display:inline-block;
}
.new-btn-login{
background-color: #ff8c00;
color: #FFFFFF;
font-weight: bold;
border: medium none;
width:82px;
height:28px;
}
.new-btn-login:hover{
background-color: #ffa300;
width: 82px;
color: #FFFFFF;
font-weight: bold;
height: 28px;
}
.bank-list{
overflow:hidden;
margin-top:5px;
}
.bank-list li{
float:left;
width:153px;
margin-bottom:5px;
}
#main{
width:750px;
margin:0 auto;
font-size:14px;
font-family:'宋体';
}
#logo{
background-color: transparent;
background-image: url("images/new-btn-fixed.png");
border: medium none;
background-position:0 0;
width:166px;
height:35px;
float:left;
}
.red-star{
color:#f00;
width:10px;
display:inline-block;
}
.null-star{
color:#fff;
}
.content{
margin-top:5px;
}
.content dt{
width:160px;
display:inline-block;
text-align:right;
float:left;
}
.content dd{
margin-left:100px;
margin-bottom:5px;
}
#foot{
margin-top:10px;
}
.foot-ul li {
text-align:center;
}
.note-help {
color: #999999;
font-size: 12px;
line-height: 130%;
padding-left: 3px;
}
.cashier-nav {
font-size: 14px;
margin: 15px 0 10px;
text-align: left;
height:30px;
border-bottom:solid 2px #CFD2D7;
}
.cashier-nav ol li {
float: left;
}
.cashier-nav li.current {
color: #AB4400;
font-weight: bold;
}
.cashier-nav li.last {
clear:right;
}
.alipay_link {
text-align:right;
}
.alipay_link a:link{
text-decoration:none;
color:#8D8D8D;
}
.alipay_link a:visited{
text-decoration:none;
color:#8D8D8D;
}
</style>
</head>
<body text=#000000 bgColor=#ffffff leftMargin=0 topMargin=4>
<div id="main">
<div id="head">
<dl class="alipay_link">
</dl>
<span class="title">彩虹易支付接口测试</span>
</div>
<div class="cashier-nav">
<ol>
<li class="current">1、确认信息 →</li>
<li>2、点击确认 →</li>
<li class="last">3、确认完成</li>
</ol>
</div>
<form name=alipayment action=epayapi.php method=post target="_blank">
<div id="body" style="clear:left">
<dl class="content">
<dt>商户订单号:</dt>
<dd>
<span class="null-star">*</span>
<input size="30" name="WIDout_trade_no" value="<?php echo date("YmdHis").mt_rand(100,999); ?>"/>
<span>商户网站订单系统中唯一订单号,必填
</span>
</dd>
<dt>商品名称:</dt>
<dd>
<span class="null-star">*</span>
<input size="30" name="WIDsubject" value="测试商品"/>
<span>必填
</span>
</dd>
<dt>付款金额:</dt>
<dd>
<span class="null-star">*</span>
<input size="30" name="WIDtotal_fee" value="1"/>
<span>必填
</span>
</dd>
<dt>支付方式:</dt>
<dd>
<label><input type="radio" name="type" value="alipay" checked="">支付宝</label>&nbsp; <label><input type="radio" name="type" value="qqpay">QQ钱包</label>&nbsp;<label><input type="radio" name="type" value="wxpay">微信支付</label>&nbsp;<label><input type="radio" name="type" value="bank">云闪付</label>
</dd>
<dt></dt>
<dd>
<span class="new-btn-login-sp">
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
</span>
</dd>
</dl>
</div>
</form>
<div id="foot">
<ul class="foot-ul">
<li><font class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。 </font></li>
<li>
</li>
</ul>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,154 @@
<?php
/* *
* 彩虹易支付SDK服务类
* 说明:
* 包含发起支付、查询订单、回调验证等功能
*/
class EpayCore
{
private $pid;
private $key;
private $submit_url;
private $mapi_url;
private $api_url;
private $sign_type = 'MD5';
function __construct($config){
$this->pid = $config['pid'];
$this->key = $config['key'];
$this->submit_url = $config['apiurl'].'submit.php';
$this->mapi_url = $config['apiurl'].'mapi.php';
$this->api_url = $config['apiurl'].'api.php';
}
// 发起支付(页面跳转)
public function pagePay($param_tmp, $button='正在跳转'){
$param = $this->buildRequestParam($param_tmp);
$html = '<form id="dopay" action="'.$this->submit_url.'" method="post">';
foreach ($param as $k=>$v) {
$html.= '<input type="hidden" name="'.$k.'" value="'.$v.'"/>';
}
$html .= '<input type="submit" value="'.$button.'"></form><script>document.getElementById("dopay").submit();</script>';
return $html;
}
// 发起支付(获取链接)
public function getPayLink($param_tmp){
$param = $this->buildRequestParam($param_tmp);
$url = $this->submit_url.'?'.http_build_query($param);
return $url;
}
// 发起支付API接口
public function apiPay($param_tmp){
$param = $this->buildRequestParam($param_tmp);
$response = $this->getHttpResponse($this->mapi_url, http_build_query($param));
$arr = json_decode($response, true);
return $arr;
}
// 异步回调验证
public function verifyNotify(){
if(empty($_GET)) return false;
$sign = $this->getSign($_GET);
if($sign === $_GET['sign']){
$signResult = true;
}else{
$signResult = false;
}
return $signResult;
}
// 同步回调验证
public function verifyReturn(){
if(empty($_GET)) return false;
$sign = $this->getSign($_GET);
if($sign === $_GET['sign']){
$signResult = true;
}else{
$signResult = false;
}
return $signResult;
}
// 查询订单支付状态
public function orderStatus($trade_no){
$result = $this->queryOrder($trade_no);
if($result['status']==1){
return true;
}else{
return false;
}
}
// 查询订单
public function queryOrder($trade_no){
$url = $this->api_url.'?act=order&pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no;
$response = $this->getHttpResponse($url);
$arr = json_decode($response, true);
return $arr;
}
// 订单退款
public function refund($trade_no, $money){
$url = $this->api_url.'?act=refund';
$post = 'pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no . '&money=' . $money;
$response = $this->getHttpResponse($url, $post);
$arr = json_decode($response, true);
return $arr;
}
private function buildRequestParam($param){
$mysign = $this->getSign($param);
$param['sign'] = $mysign;
$param['sign_type'] = $this->sign_type;
return $param;
}
// 计算签名
private function getSign($param){
ksort($param);
reset($param);
$signstr = '';
foreach($param as $k => $v){
if($k != "sign" && $k != "sign_type" && $v!=''){
$signstr .= $k.'='.$v.'&';
}
}
$signstr = substr($signstr,0,-1);
$signstr .= $this->key;
$sign = md5($signstr);
return $sign;
}
// 请求外部资源
private function getHttpResponse($url, $post = false, $timeout = 10){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$httpheader[] = "Accept: */*";
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
$httpheader[] = "Connection: close";
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
}

View File

@@ -0,0 +1,13 @@
<?php
/* *
* 配置文件
*/
//支付接口地址
$epay_config['apiurl'] = 'http://pay.www.com/';
//商户ID
$epay_config['pid'] = '1000';
//商户密钥
$epay_config['key'] = 'WWc3Z2jkK7jhNGPALcGKjHLPK47wRK85';

View File

@@ -0,0 +1,45 @@
<?php
/* *
* 功能:彩虹易支付异步通知页面
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
//计算得出通知验证结果
$epay = new EpayCore($epay_config);
$verify_result = $epay->verifyNotify();
if($verify_result) {//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//彩虹易支付交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//支付方式
$type = $_GET['type'];
//支付金额
$money = $_GET['money'];
if ($_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
}
//验证成功返回
echo "success";
}
else {
//验证失败
echo "fail";
}
?>

View File

@@ -0,0 +1,55 @@
<?php
/* *
* 功能:彩虹易支付页面跳转同步通知页面
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付返回页面</title>
</head>
<body>
<?php
//计算得出通知验证结果
$epay = new EpayCore($epay_config);
$verify_result = $epay->verifyReturn();
if($verify_result) {//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//支付宝交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//支付方式
$type = $_GET['type'];
if($_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
}
else {
echo "trade_status=".$_GET['trade_status'];
}
echo "<h3>验证成功</h3><br />";
}
else {
//验证失败
echo "<h3>验证失败</h3>";
}
?>
</body>
</html>

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>正在为您跳转到支付页面,请稍候...</title>
<style type="text/css">
body{margin:0;padding:0}
p{position:absolute;left:50%;top:50%;height:35px;margin:-35px 0 0 -160px;padding:20px;font:bold 16px/30px "宋体",Arial;text-indent:40px;border:1px solid #c5d0dc}
#waiting{font-family:Arial}
</style>
</head>
<body>
<?php
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
/**************************请求参数**************************/
$notify_url = "http://127.0.0.1/SDK/notify_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = "http://127.0.0.1/SDK/return_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//商户订单号
$out_trade_no = $_POST['out_trade_no'];
//商户网站订单系统中唯一订单号,必填
//支付方式可传入alipay,wxpay,qqpay,bank,jdpay
$type = $_POST['type'];
//商品名称
$name = $_POST['name'];
//付款金额
$money = $_POST['money'];
/************************************************************/
//构造要请求的参数数组,无需改动
$parameter = array(
"type" => $type,
"notify_url" => $notify_url,
"return_url" => $return_url,
"out_trade_no" => $out_trade_no,
"name" => $name,
"money" => $money,
);
//建立请求
$epay = new EpayCore($epay_config);
$html_text = $epay->pagePay($parameter);
echo $html_text;
?>
<p>正在为您跳转到支付页面,请稍候...</p>
</body>
</html>

View File

@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="zh-CN">
<body>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>彩虹易支付接口测试</title>
<link href="//lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./assets/css/captcha.css" type="text/css" />
<style>.form-group{margin-bottom:18px} #captcha{margin: auto;margin-bottom:16px}</style>
</head>
<div class="container">
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
<div class="page-header">
<h4>彩虹易支付接口测试</h4>
</div>
<div class="panel panel-primary">
<div class="panel-body">
<form name="alipayment" method="POST" action="epayapi.php" class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">商户订单号</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="out_trade_no" value="<?php echo date("YmdHis").mt_rand(100,999); ?>" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">商品名称</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="name" value="支付测试" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">支付金额</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="money" value="1" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">支付方式</label>
<div class="col-sm-8">
<div class="radio">
<label class="i-checks"><input type="radio" name="type" value="alipay" checked="checked"><i></i>支付宝</label>&nbsp;
<label class="i-checks"><input type="radio" name="type" value="wxpay"><i></i>微信支付</label>&nbsp;
<label class="i-checks"><input type="radio" name="type" value="qqpay"><i></i>QQ钱包</label>&nbsp;
<label class="i-checks"><input type="radio" name="type" value="bank"><i></i>云闪付</label>&nbsp;
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-8"><input type="submit" value="确 认" class="btn btn-primary form-control"><br>
</div>
</div>
</form>
</div>
<div class="panel-footer text-center">
<span class="text-muted">此页面只是为了方便商户测试而提供的样例页面,商户可以根据自己网站的需要,按照技术文档编写</span>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,184 @@
<?php
/* *
* 彩虹易支付SDK服务类
* 说明:
* 包含发起支付、查询订单、回调验证等功能
*/
class EpayCore
{
private $apiurl;
private $pid;
private $platform_public_key;
private $merchant_private_key;
private $sign_type = 'RSA';
function __construct($config){
$this->apiurl = $config['apiurl'];
$this->pid = $config['pid'];
$this->platform_public_key = $config['platform_public_key'];
$this->merchant_private_key = $config['merchant_private_key'];
}
// 发起支付(页面跳转)
public function pagePay($param_tmp, $button='正在跳转'){
$requrl = $this->apiurl.'api/pay/submit';
$param = $this->buildRequestParam($param_tmp);
$html = '<form id="dopay" action="'.$requrl.'" method="post">';
foreach ($param as $k=>$v) {
$html.= '<input type="hidden" name="'.$k.'" value="'.$v.'"/>';
}
$html .= '<input type="submit" value="'.$button.'"></form><script>document.getElementById("dopay").submit();</script>';
return $html;
}
// 发起支付(获取链接)
public function getPayLink($param_tmp){
$requrl = $this->apiurl.'api/pay/submit';
$param = $this->buildRequestParam($param_tmp);
$url = $requrl.'?'.http_build_query($param);
return $url;
}
// 发起支付API接口
public function apiPay($params){
return $this->execute('api/pay/create', $params);
}
// 发起API请求
public function execute($path, $params){
$path = ltrim($path, '/');
$requrl = $this->apiurl.$path;
$param = $this->buildRequestParam($params);
$response = $this->getHttpResponse($requrl, http_build_query($param));
$arr = json_decode($response, true);
if($arr && $arr['code'] == 0){
if(!$this->verify($arr)){
throw new \Exception('返回数据验签失败');
}
return $arr;
}else{
throw new \Exception($arr ? $arr['msg'] : '请求失败');
}
}
// 回调验证
public function verify($arr){
if(empty($arr) || empty($arr['sign'])) return false;
if(empty($arr['timestamp']) || abs(time() - $arr['timestamp']) > 300) return false;
$sign = $arr['sign'];
return $this->rsaPublicVerify($this->getSignContent($arr), $sign);
}
// 查询订单支付状态
public function orderStatus($trade_no){
$result = $this->queryOrder($trade_no);
if($result && $result['status']==1){
return true;
}else{
return false;
}
}
// 查询订单
public function queryOrder($trade_no){
$params = [
'trade_no' => $trade_no,
];
return $this->execute('api/pay/query', $params);
}
// 订单退款
public function refund($out_refund_no, $trade_no, $money){
$params = [
'trade_no' => $trade_no,
'money' => $money,
'out_refund_no' => $out_refund_no,
];
return $this->execute('api/pay/refund', $params);
}
private function buildRequestParam($params){
$params['pid'] = $this->pid;
$params['timestamp'] = time().'';
$mysign = $this->getSign($params);
$params['sign'] = $mysign;
$params['sign_type'] = $this->sign_type;
return $params;
}
// 生成签名
private function getSign($params){
return $this->rsaPrivateSign($this->getSignContent($params));
}
// 获取待签名字符串
private function getSignContent($params){
ksort($params);
$signstr = '';
foreach ($params as $k => $v) {
if(is_array($v) || $this->isEmpty($v) || $k == 'sign' || $k == 'sign_type') continue;
$signstr .= '&' . $k . '=' . $v;
}
$signstr = substr($signstr, 1);
return $signstr;
}
private function isEmpty($value)
{
return $value === null || trim($value) === '';
}
// 商户私钥签名
private function rsaPrivateSign($data){
$key = "-----BEGIN PRIVATE KEY-----\n" .
wordwrap($this->merchant_private_key, 64, "\n", true) .
"\n-----END PRIVATE KEY-----";
$privatekey = openssl_get_privatekey($key);
if(!$privatekey){
throw new \Exception('签名失败,商户私钥错误');
}
openssl_sign($data, $sign, $privatekey, OPENSSL_ALGO_SHA256);
return base64_encode($sign);
}
// 平台公钥验签
private function rsaPublicVerify($data, $sign){
$key = "-----BEGIN PUBLIC KEY-----\n" .
wordwrap($this->platform_public_key, 64, "\n", true) .
"\n-----END PUBLIC KEY-----";
$publickey = openssl_get_publickey($key);
if (!$publickey) {
throw new \Exception("验签失败,平台公钥错误");
}
$result = openssl_verify($data, base64_decode($sign), $publickey, OPENSSL_ALGO_SHA256);
return $result === 1;
}
// 请求外部资源
private function getHttpResponse($url, $post = false, $timeout = 10){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$httpheader[] = "Accept: */*";
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
$httpheader[] = "Connection: close";
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
}

View File

@@ -0,0 +1,19 @@
<?php
/* *
* 配置文件
*/
$epay_config = [
//支付接口地址
'apiurl' => 'http://pay.www.com/',
//商户ID
'pid' => '1000',
//平台公钥
'platform_public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApHG7SIN16fd9uZfjZunZuAReemVQe5YNxBhbkogsRkZ86xuDVDCmhRXEzw7Ta3tXPnMIFRJFdjOCfFVarqcOLICtBiiZZ7Y4D6aIMhmOSliIJ3qWUnU75Wr2WMTIJ1o2pnPmczQ2YjAAy1DtQCc/qs35j24zuNYZw2WluSdiMckPFgge93RK6cq/Feqfuzq7y+m87x02gxbbTGVf24YH2f7H9qZSKCxRXHQoVIWTlyHULcY3OY+1CVdU2SKlIWHJ31eoPznXBLUo0UB0rNZnYrHG2mIlD2S119UTwZwx9WTG/v7Cb2lHVybjfL5/KLitddfqcLjJsYXh6KhEtsO6CwIDAQAB',
//商户私钥
'merchant_private_key' => 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCBIB1e5lAYtFyXq5I8UIQ6KidYZcWkn0SwVS8Rk0SNZVrvL/UJk6Q1zkJs4pUCykTBS/tTrP2rNPOsK1VO/AQHIzhvAujsv7UK2LptcsuNRPCF5GYxndQnOawAGKNQKsMuNcDzyuyTMbZIBEYSRWIoU3dMz4wWEFso/VdVS4uKTZWZnBOeCDdzDAJ7TwbmaOkT919DfZbXAoMH9n3sG4BMpqQExTDoFY6dq6EPXCWVZgoUfecAgNKSfX5TagSUaAxq4eF5vsUfvj+LFpYIrIssmSVErtZuRXLHWVSEbsNxdDPNuS3BtxWEY7GRPF9RJevtoC5L5LN7Gn+RYCqZNZv7AgMBAAECggEAEA6ZTb11hQzwsrUAM1s5MNkgbsABIDk6BnTMAfMpRC1awyxYhqoDHTnFTYWuTVwvyUW/PtGKnelbdTPSS5x6jRSr0N+GGDgNYF2Wbpkm3Ni6Jubsb7ZrtRED5Y3Vc9j4JTKZXaJaDEJ9+LNSBLWiFi0C7zH5U/O8ElB8CrxL4ZUaZv0JgV9NcDpS5jAtpPSyBLrdhbEheertJiHQU0V+FaaXq8taNcYIA/Xim6+vqcFFtUA3PBBTXHn/NE5uasXi+N+De4IT+dBmirzVSZjviDPr9RSBUi6KPUSXx6eDa26SKeEqJZvBtlASDM+ZC0yhDz0eyV49tMjk7eF5fnCIwQKBgQC2nEiR2t5Q02tHaKesZMRGOwxEyMFQj6viDW+Yffg59Tu6QYuqdR558/zmzWcJFMH3DVQzTXpzPNU9TA3/yT/Q42iKBP70K8O9tJO+gd/jLHLqgw90Wyh2b4FJXXQqVQMkxGBQKRfNi6krWigJNBs8Z8IhczorQHYNbBIUI05poQKBgQC1BRI8zKf+85GuJXTxJ93RXbkOQMUIhT/6eyFTZvCLC9Qqba1/1ouNbtmxNsFFIC+n+rHRN9btKt90m9YFvXD90m3y34M88QjvaQcA1Kng9Q6Xia8DizpVIYGAR/Pfn36BZQeHHVz9te6QJ9hVOgZO3GG62Echd9M/rwOzuU14GwKBgFGtS2Q5khByz9wLuluIYqXLCWzGoninGkksm0qIpXs+7e0cHh0q72u6rtaI7toH983Jn2ym7esXPYWCPAy5dhq3bG23WFXcMVvrpd2i94IDwo6T+lif4VRAAYLQEwJQLezHDREtoCDmo87pL1kWfkwhWJpfkJgB6AuO1/M763mhAoGBAIPEGj9plcwOzndeSp6UL3IMb/1BBmuqWyTgZiTIpMYCKUFtLsMEj/a2vv2xZsQDpsz2vmMV63weHiRKn2L0QABzIZeOPYCpz6A96lwfcT0QBLwn+95vhVmclyCiv5GDDtnviag/poYD3ZDPgDihkR/sabNRZY2mJH6RzfcQJqULAoGALkSkqr0bplhfyAA6bO42l64th4YUqwouTEgp7rE36wQ28THj0a88HLU4CeiCR6LQAEGpKk04Vst97C1Q5ZeD5rc4xKINl8K5HUH8SsdMDq3r22xur2qr4kanW4hf2P/ehOeEKGuhSL+ZWeApvt1c0rqH4MQT1/7qR/dO2MikkMg=',
];

View File

@@ -0,0 +1,45 @@
<?php
/* *
* 功能:彩虹易支付异步通知页面
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
//计算得出通知验证结果
$epay = new EpayCore($epay_config);
$verify_result = $epay->verify($_GET);
if($verify_result) {//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//彩虹易支付交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//支付方式
$type = $_GET['type'];
//支付金额
$money = $_GET['money'];
if ($_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
}
//验证成功返回
echo "success";
}
else {
//验证失败
echo "fail";
}
?>

View File

@@ -0,0 +1,17 @@
<?php
/**
* 查询订单
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
$trade_no = '2024071519404366151';
$epay = new EpayCore($epay_config);
try{
$result = $epay->queryOrder($trade_no);
}catch(Exception $e){
echo $e->getMessage();
exit;
}
print_r($result);

View File

@@ -0,0 +1,19 @@
<?php
/**
* 退款
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
$out_refund_no = date("YmdHis").rand(111,999);
$trade_no = '2024071519404366151';
$money = '1.00';
$epay = new EpayCore($epay_config);
try{
$result = $epay->refund($out_refund_no, $trade_no, $money);
}catch(Exception $e){
echo $e->getMessage();
exit;
}
print_r($result);

View File

@@ -0,0 +1,55 @@
<?php
/* *
* 功能:彩虹易支付页面跳转同步通知页面
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付返回页面</title>
</head>
<body>
<?php
//计算得出通知验证结果
$epay = new EpayCore($epay_config);
$verify_result = $epay->verify($_GET);
if($verify_result) {//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//支付宝交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//支付方式
$type = $_GET['type'];
if($_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
}
else {
echo "trade_status=".$_GET['trade_status'];
}
echo "<h3>验证成功</h3><br />";
}
else {
//验证失败
echo "<h3>验证失败</h3>";
}
?>
</body>
</html>

37
doc/api/mer.md Normal file
View File

@@ -0,0 +1,37 @@
# 商户后台接口
`mer` 前端调用 `/merapi`,接口定义在 `mpay/app/route/mer.php`
## 基本信息
- 页面入口:`/mer`
- API 前缀:`/merapi`
- 登录接口:`POST /login`
- 登录主体:`ma_merchant`
- 保护接口:`MerchantAuthMiddleware`
- 前端封装:`mer/src/api/modules/*`
## 模块速览
| 模块 | 主要路径 |
| --- | --- |
| 认证 | `/login``/logout``/user/profile` |
| 商户资料 | `/merchant/profile``/merchant/change-password` |
| 通道与路由 | `/my-channels``/my-channels/create-meta``/plugin-configs``/plugin-configs/options``/payment-plugins/{code}/schema``/route-preview` |
| API 凭证 | `/api-credential``/api-credential/issue-credential` |
| 订单 | `/pay-orders``/refund-orders``/refund-orders/{refundNo}``/refund-orders/{refundNo}/retry` |
| 清算 | `/settlement-records``/settlement-records/{settleNo}` |
| 资金 | `/withdrawable-balance``/balance-flows` |
| 系统 | `/system/menu-tree``/system/dict-items` |
## 关联代码
- 控制器:`mpay/app/http/mer/controller`
- 校验器:`mpay/app/http/mer/validation`
- 前端接口:`mer/src/api/modules`
## 商户自助通道
- 商户可新增、修改、删除 `merchant_id=当前商户` 的自有通道。
- 商户新增插件配置时只能选择管理后台标记为“允许商户端自助使用”的启用插件。
- 商户通道绑定的 `api_config_id` 必须属于当前商户,不能引用平台配置或其它商户配置。

109
doc/api/pages/alipay_h5.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
// 支付宝H5支付页面
if (!defined('IN_PLUGIN'))
exit();
?>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>支付宝支付手机版</title>
<link href="<?php echo $cdnpublic ?>twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="/assets/pay/css/mobile-style.css" rel="stylesheet" />
</head>
<body>
<div class="main">
<div class="bg-ali"></div>
<div class="payment-logo">
<img src="/assets/pay/icon/alipay-white.svg" alt="logo">
<span class="logo-tile">支付宝支付</span>
</div>
<div class="payment-content">
<div class="content-info">
<h1>¥<?php echo $order['realmoney'] ?></h1>
<ul class="nk-activity">
<li class="nk-activity-item">
<span>商品名称:<?php echo $order['name'] ?></span>
</li>
<li class="nk-activity-item">
<span>商户订单号:<?php echo $order['trade_no'] ?></span>
</li>
<li class="nk-activity-item">
<span>创建时间:<?php echo $order['addtime'] ?></span>
</li>
</ul>
</div>
<div class="content-footer">
<a href="javascript:;" id="openUrl" class="btn btn-primary btn-block btn-lg">跳转到支付宝支付</a>
<a href="javascript:checkresult()" onclick="" class="btn btn-info btn-block btn-lg">检测支付状态</a>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic ?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic ?>layer/3.1.1/layer.js"></script>
<script>
var url_scheme = '<?php echo $code_url ?>';
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: { type: "wxpay", trade_no: "<?php echo $order['trade_no'] ?>" },
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', { icon: 16, shade: 0.01, time: 15000 });
setTimeout(window.location.href = <?php echo $redirect_url ?>, 1000);
} else {
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
function checkresult() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: { type: "wxpay", trade_no: "<?php echo $order['trade_no'] ?>" },
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', { icon: 16, shade: 0.01, time: 15000 });
setTimeout(window.location.href = <?php echo $redirect_url ?>, 1000);
} else {
layer.msg('您还未完成付款,请继续付款', { shade: 0, time: 1500 });
}
},
error: function () {
layer.msg('服务器错误');
}
});
}
window.onload = function () {
window.onpopstate = function (e) {
if (e.state == 'forward' || confirm('是否取消支付并返回?')) {
window.history.back();
} else {
e.preventDefault();
window.history.pushState('forward', null, '');
}
};
window.history.pushState('forward', null, '');
document.getElementById("openUrl").href = url_scheme;
if (!url_scheme.startsWith('http://') && !url_scheme.startsWith('https://') && navigator.userAgent.indexOf('EdgA/') == -1) {
window.location.href = url_scheme;
}
setTimeout("loadmsg()", 3000);
}
</script>
</body>
</html>

View File

@@ -0,0 +1,84 @@
<?php
// 支付宝JS支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>支付宝支付</title>
<link href="/assets/pay/css/weui.css" rel="stylesheet" />
</head>
<body>
<div class="container js_container">
<div class="page msg">
<div class="weui_msg">
<div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div>
<div class="weui_text_area">
<h2 class="weui_msg_title">正在跳转支付...</h2>
</div>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script>
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
var tradeNO = '<?php echo $alipay_trade_no?>';
function Alipayready(callback) {
if (window.AlipayJSBridge) {
callback && callback();
} else {
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
}
function AlipayJsPay() {
Alipayready(function(){
AlipayJSBridge.call("tradePay",{
tradeNO: tradeNO
}, function(result){
var msg = "";
if(result.resultCode == "9000"){
loadmsg();
}else if(result.resultCode == "8000"){
msg = "正在处理中";
}else if(result.resultCode == "4000"){
msg = "订单支付失败";
}else if(result.resultCode == "6002"){
msg = "网络连接出错";
}
if (msg!="") {
layer.msg(msg);
}
});
});
}
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "wxpay", trade_no: "<?php echo TRADE_NO?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.01,time: 15000});
window.location.href=<?php echo $redirect_url?>;
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = AlipayJsPay();
</script>
</body>
</html>

View File

@@ -0,0 +1,169 @@
<?php
// 支付宝扫码支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="renderer" content="webkit">
<title>支付宝扫码支付</title>
<link href="/assets/css/alipay_pay.css?v=3" rel="stylesheet" media="screen">
</head>
<body>
<img src="/assets/img/guide1.png" alt="引导图" class="top-guide" style="max-width: 100%;margin: auto;display:none">
<div class="guide" style="display:none"><img src="/assets/img/guide2.png" alt="引导图" style="width: 96%;"></div>
<div class="body">
<h1 class="mod-title">
<span class="ico-wechat"></span><span class="text">支付宝扫码支付</span>
</h1>
<div class="mod-ct">
<div class="order">
</div>
<div class="amount">¥<?php echo $order['realmoney']?></div>
<div class="qr-image" id="qrcode">
</div>
<div class="open_app" style="display: none;">
<a class="btn-open-app">打开支付宝APP继续付款</a><br/><br/><br/>
<a onclick="checkresult()" class="btn-check">我已付款,返回查看订单</a>
</div>
<div class="detail" id="orderDetail">
<dl class="detail-ct" style="display: none;">
<dt>购买物品</dt>
<dd id="productName"><?php echo $order['name']?></dd>
<dt>商户订单号</dt>
<dd id="billId"><?php echo $order['trade_no']?></dd>
<dt>创建时间</dt>
<dd id="createTime"><?php echo $order['addtime']?></dd>
</dl>
<a href="javascript:void(0)" class="arrow"><i class="ico-arrow"></i></a>
</div>
<div class="tip">
<span class="dec dec-left"></span>
<span class="dec dec-right"></span>
<div class="ico-scan"></div>
<div class="tip-text">
<p>请使用支付宝扫一扫</p>
<p>扫描二维码完成支付</p>
</div>
</div>
<div class="tip-text">
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
var code_url = '<?php echo $code_url?>';
var code_type = code_url.indexOf('data:image/')>-1?1:0;
if(code_type == 0){
var url_scheme = 'alipays://platformapi/startapp?appId=20000067&url=' + encodeURIComponent(code_url);
$('#qrcode').qrcode({
text: code_url,
width: 230,
height: 230,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
}else{
$('#qrcode').html('<img src="'+code_url+'"/>');
}
// 订单详情
$('#orderDetail .arrow').click(function (event) {
if ($('#orderDetail').hasClass('detail-open')) {
$('#orderDetail .detail-ct').slideUp(500, function () {
$('#orderDetail').removeClass('detail-open');
});
} else {
$('#orderDetail .detail-ct').slideDown(500, function () {
$('#orderDetail').addClass('detail-open');
});
}
});
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "alipay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
function checkresult() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "alipay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
layer.msg('您还未完成付款,请继续付款', {shade: 0,time: 1500});
}
},
error: function () {
layer.msg('服务器错误');
}
});
}
var isMobile = function (){
var ua = navigator.userAgent;
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
isIphone =!ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
isAndroid = ua.match(/(Android)\s+([\d.]+)/);
return isIphone || isAndroid;
}
function wx_open(){
$(".guide").show();
//layer.alert('请点击屏幕右上角,<b>在浏览器打开</b>即可跳转支付。<br/><font color="red">支付成功后,回到微信查看结果</font>', {title:'支付提示'});
}
window.onload = function(){
if(isMobile()){
window.onpopstate=function (e) {
if(e.state=='forward' || confirm('是否取消支付并返回?')){
window.history.back();
}else{
e.preventDefault();
window.history.pushState('forward', null, '');
}
};
window.history.pushState('forward', null, '');
}
if(isMobile() && code_type==0){
$('.open_app').show();
if(navigator.userAgent.indexOf('MicroMessenger/')>0){
$(".top-guide").show();
$('.btn-open-app').attr('href', 'javascript:wx_open()');
}else{
$('.btn-open-app').attr('href', url_scheme)
if(navigator.userAgent.indexOf('EdgA/')==-1 && $(window).height() > $(window).width()){
setTimeout(window.location.href = url_scheme, 1000);
}
}
}
$("body").click(function(){
if (!$(".guide").is(":hidden")) {
$(".guide").hide();
}
});
setTimeout("loadmsg()", 2000);
}
</script>
</body>
</html>

View File

@@ -0,0 +1,91 @@
<?php
// 支付宝扫码支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="renderer" content="webkit">
<title>支付宝扫码支付</title>
<link href="/assets/css/alipay_pay.css?v=2" rel="stylesheet" media="screen">
</head>
<body>
<div class="body">
<h1 class="mod-title">
<span class="ico-wechat"></span><span class="text">支付宝扫码支付</span>
</h1>
<div class="mod-ct">
<div class="order">
</div>
<div class="amount">¥<?php echo $order['realmoney']?></div>
<div class="qr-image" id="qrcode">
<iframe src="<?php echo $code_url?>" width="230px" height="230px" frameborder="0" scrolling="no" seamless></iframe>
</div>
<div class="detail" id="orderDetail">
<dl class="detail-ct" style="display: none;">
<dt>购买物品</dt>
<dd id="productName"><?php echo $order['name']?></dd>
<dt>商户订单号</dt>
<dd id="billId"><?php echo $order['trade_no']?></dd>
<dt>创建时间</dt>
<dd id="createTime"><?php echo $order['addtime']?></dd>
</dl>
<a href="javascript:void(0)" class="arrow"><i class="ico-arrow"></i></a>
</div>
<div class="tip">
<span class="dec dec-left"></span>
<span class="dec dec-right"></span>
<div class="ico-scan"></div>
<div class="tip-text">
<p>请使用支付宝扫一扫</p>
<p>扫描二维码完成支付</p>
</div>
</div>
<div class="tip-text">
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
// 订单详情
$('#orderDetail .arrow').click(function (event) {
if ($('#orderDetail').hasClass('detail-open')) {
$('#orderDetail .detail-ct').slideUp(500, function () {
$('#orderDetail').removeClass('detail-open');
});
} else {
$('#orderDetail .detail-ct').slideDown(500, function () {
$('#orderDetail').addClass('detail-open');
});
}
});
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "alipay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = function(){
setTimeout("loadmsg()", 2000);
}
</script>
</body>
</html>

View File

@@ -0,0 +1,149 @@
<?php
// 银联云闪付扫码支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="renderer" content="webkit">
<title>银联云闪付扫码支付</title>
<link href="/assets/css/bank_pay.css?v=3" rel="stylesheet" media="screen">
</head>
<body>
<div class="body">
<h1 class="mod-title">
<span class="ico-wechat"></span><span class="text">银联云闪付扫码支付</span>
</h1>
<div class="mod-ct">
<div class="order">
</div>
<div class="amount">¥<?php echo $order['realmoney']?></div>
<div class="qr-image" id="qrcode">
</div>
<div class="open_app" style="display: none;">
<a class="btn-open-app">打开云闪付APP继续付款</a><br/><br/><br/>
<a onclick="checkresult()" class="btn-check">我已付款,返回查看订单</a>
</div>
<div class="detail" id="orderDetail">
<dl class="detail-ct" style="display: none;">
<dt>购买物品</dt>
<dd id="productName"><?php echo $order['name']?></dd>
<dt>商户订单号</dt>
<dd id="billId"><?php echo $order['trade_no']?></dd>
<dt>创建时间</dt>
<dd id="createTime"><?php echo $order['addtime']?></dd>
</dl>
<a href="javascript:void(0)" class="arrow"><i class="ico-arrow"></i></a>
</div>
<div class="tip">
<span class="dec dec-left"></span>
<span class="dec dec-right"></span>
<div class="ico-scan"></div>
<div class="tip-text">
<p>请使用银联云闪付扫一扫</p>
<p>扫描二维码完成支付</p>
</div>
</div>
<div class="tip-text">
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
var code_url = '<?php echo $code_url?>';
var code_type = code_url.indexOf('data:image/')>-1?1:0;
if(code_type == 0){
var url_scheme = 'upwallet://html/' + code_url.replace('https://', '').replace('http://', '');
$('#qrcode').qrcode({
text: code_url,
width: 230,
height: 230,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
}else{
$('#qrcode').html('<img src="'+code_url+'"/>');
}
// 订单详情
$('#orderDetail .arrow').click(function (event) {
if ($('#orderDetail').hasClass('detail-open')) {
$('#orderDetail .detail-ct').slideUp(500, function () {
$('#orderDetail').removeClass('detail-open');
});
} else {
$('#orderDetail .detail-ct').slideDown(500, function () {
$('#orderDetail').addClass('detail-open');
});
}
});
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "bank", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
function checkresult() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "bank", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
layer.msg('您还未完成付款,请继续付款', {shade: 0,time: 1500});
}
},
error: function () {
layer.msg('服务器错误');
}
});
}
var isMobile = function (){
var ua = navigator.userAgent;
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
isIphone =!ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
isAndroid = ua.match(/(Android)\s+([\d.]+)/);
return isIphone || isAndroid;
}
function wx_open(){
layer.alert('请点击屏幕右上角,<b>在浏览器打开</b>即可跳转支付。<br/><font color="red">支付成功后,回到微信查看结果</font>', {title:'支付提示'});
}
window.onload = function(){
if(isMobile() && code_type==0){
$('.open_app').show();
if(navigator.userAgent.indexOf('MicroMessenger/')>0){
$('.btn-open-app').attr('onclick', 'wx_open()');
}else{
$('.btn-open-app').attr('href', url_scheme);
if(navigator.userAgent.indexOf('EdgA/')==-1 && $(window).height() > $(window).width()){
window.location.href = url_scheme;
}
}
}
setTimeout("loadmsg()", 2000);
}
</script>
</body>
</html>

79
doc/api/pages/certok.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
/**
* 实名认证成功页面
**/
if(!defined('IN_CRONLITE'))exit();
?>
<html class="weui-msg">
<head>
<meta charset="UTF-8">
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>实名认证成功</title>
<link href="/assets/css/weui.min.css" rel="stylesheet">
<style>.page{position:absolute;top:0;right:0;bottom:0;left:0;overflow-y:auto;-webkit-overflow-scrolling:touch;box-sizing:border-box}</style>
</head>
<body>
<div class="container">
<div class="page">
<div class="weui-msg">
<div class="weui-msg__icon-area">
<i class="weui-icon-success weui-icon_msg"></i>
</div>
<div class="weui-msg__text-area">
<h2 class="weui-msg__title">实名认证成功</h2>
<p class="weui-msg__desc">请返回浏览器查看结果</p>
</div>
<div class="weui-msg__opr-area">
<p class="weui-btn-area">
<a href="javascript:;" class="weui-btn weui-btn_default" id="Close">关闭</a>
</p>
</div>
<div class="weui-msg__extra-area">
<div class="weui-footer"><p class="weui-footer__links"></p></div>
</div>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script>
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
if(navigator.userAgent.indexOf("AlipayClient") > -1){
function Alipayready(callback) {
if (window.AlipayJSBridge) {
callback && callback();
} else {
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
}
Alipayready(function(){
$('#Close').click(function() {
AlipayJSBridge.call('popWindow');
});
})
}else if(navigator.userAgent.indexOf("MicroMessenger") > -1){
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
} else {
jsApiCall();
}
function jsApiCall() {
$('#Close').click(function() {
WeixinJSBridge.call('closeWindow');
});
}
}else{
$('#Close').click(function() {
window.opener=null;window.close();
});
}
</script>
</body>
</html>

38
doc/api/pages/error.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
/*
* 支付失败提示页面
*/
if(!defined('IN_PLUGIN'))exit();
?>
<html class="weui-msg">
<head>
<meta charset="UTF-8">
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>错误提示</title>
<link href="/assets/css/weui.min.css" rel="stylesheet">
<style>.page{position:absolute;top:0;right:0;bottom:0;left:0;overflow-y:auto;-webkit-overflow-scrolling:touch;box-sizing:border-box}</style>
</head>
<body>
<div class="container">
<div class="page">
<div class="weui-msg">
<div class="weui-msg__icon-area">
<i class="weui-icon-warn weui-icon_msg"></i>
</div>
<div class="weui-msg__text-area">
<h2 class="weui-msg__title">错误提示</h2>
<p class="weui-msg__desc">支付失败或支付超时,请返回重新发起支付</p>
</div>
<div class="weui-msg__extra-area">
<div class="weui-footer"><p class="weui-footer__links"></p></div>
</div>
</div>
</div>
</div>
<script>
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
</script>
</body>
</html>

View File

@@ -0,0 +1,108 @@
<?php
// 京东扫码支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="renderer" content="webkit">
<title>京东扫码支付</title>
<link href="/assets/css/jd_pay.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="body">
<h1 class="mod-title">
<span class="ico-wechat"></span><span class="text">京东扫码支付</span>
</h1>
<div class="mod-ct">
<div class="order">
</div>
<div class="amount">¥<?php echo $order['realmoney']?></div>
<div class="qr-image" id="qrcode">
</div>
<div class="detail" id="orderDetail">
<dl class="detail-ct" style="display: none;">
<dt>商家</dt>
<dd id="storeName"><?php echo $sitename?></dd>
<dt>购买物品</dt>
<dd id="productName"><?php echo $order['name']?></dd>
<dt>商户订单号</dt>
<dd id="billId"><?php echo $order['trade_no']?></dd>
<dt>创建时间</dt>
<dd id="createTime"><?php echo $order['addtime']?></dd>
</dl>
<a href="javascript:void(0)" class="arrow"><i class="ico-arrow"></i></a>
</div>
<div class="tip">
<span class="dec dec-left"></span>
<span class="dec dec-right"></span>
<div class="ico-scan"></div>
<div class="tip-text">
<p>请使用京东APP扫一扫</p>
<p>扫描二维码完成支付</p>
</div>
</div>
<div class="tip-text">
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
var code_url = '<?php echo $code_url?>';
var code_type = code_url.indexOf('data:image/')>-1?1:0;
if(code_type == 0){
$('#qrcode').qrcode({
text: code_url,
width: 230,
height: 230,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
}else{
$('#qrcode').html('<img src="'+code_url+'"/>');
}
// 订单详情
$('#orderDetail .arrow').click(function (event) {
if ($('#orderDetail').hasClass('detail-open')) {
$('#orderDetail .detail-ct').slideUp(500, function () {
$('#orderDetail').removeClass('detail-open');
});
} else {
$('#orderDetail .detail-ct').slideDown(500, function () {
$('#orderDetail').addClass('detail-open');
});
}
});
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "jdpay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = function(){
setTimeout("loadmsg()", 2000);
}
</script>
</body>
</html>

67
doc/api/pages/jump.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
if(!defined('IN_PLUGIN'))exit();
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if(strpos($useragent, 'iphone')!==false || strpos($useragent, 'ipod')!==false){
$alert = '<img src="//puep.qpic.cn/coral/Q3auHgzwzM4fgQ41VTF2rLrNvRzmibibqrjTFj5g2kzGyoQj3ViartAEQ/0" class="icon-safari" /> <span id="openm">Safari打开</span>';
}elseif(strpos($useragent, 'micromessenger')!==false){
$alert = '<img src="//puep.qpic.cn/coral/Q3auHgzwzM4fgQ41VTF2rLbNVmztN9ia6GPRJ0IFicucFTr4Pp8xzibsw/0" class="icon-safari" /> <span id="openm">浏览器打开</span>';
}else{
$alert = '<img src="//puep.qpic.cn/coral/Q3auHgzwzM4fgQ41VTF2rOCTm6gtUeQKX7m84xg47iaVosibGckrP0JQ/0" class="icon-safari" /> <span id="openm">浏览器打开</span>';
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>请使用浏览器打开</title>
<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 name="format-detection" content="telephone=no"/>
<meta content="false" name="twcClient" id="twcClient"/>
<meta name="aplus-touch" content="1"/>
<style>
body,html{width:100%;height:100%}
*{margin:0;padding:0}
body{background-color:#fff}
.top-bar-guidance{font-size:15px;color:#fff;height:70%;line-height:1.8;padding-left:20px;padding-top:20px;background:url(//gw.alicdn.com/tfs/TB1eSZaNFXXXXb.XXXXXXXXXXXX-750-234.png) center top/contain no-repeat}
.top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}
.app-download-tip{margin:0 auto;width:290px;text-align:center;font-size:15px;color:#2466f4;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcAQMAAACak0ePAAAABlBMVEUAAAAdYfh+GakkAAAAAXRSTlMAQObYZgAAAA5JREFUCNdjwA8acEkAAAy4AIE4hQq/AAAAAElFTkSuQmCC) left center/auto 15px repeat-x}
.app-download-tip .guidance-desc{background-color:#fff;padding:0 5px}
.app-download-btn{display:block;width:214px;height:40px;line-height:40px;margin:18px auto 0 auto;text-align:center;font-size:18px;color:#2466f4;border-radius:20px;border:.5px #2466f4 solid;text-decoration:none}
</style>
</head>
<body>
<div class="top-bar-guidance">
<p>点击右上角<?php echo $alert?></p>
<p>可以继续浏览本站哦~</p>
</div>
<div class="app-download-tip">
<span class="guidance-desc">您也可以复制本站网址,到其它浏览器打开</span>
</div>
<a class="app-download-btn" id="J_BtnDowanloadApp">点此继续访问</a>
<a style="display: none;" href="" id="vurl" rel="noreferrer"></a>
<script src="//lib.baomitu.com/jquery/1.12.4/jquery.min.js"></script>
<script>
function openu(u){
document.getElementById("vurl").href= u;
document.getElementById("vurl").click();
}
var url = window.location.href;
document.querySelector('body').addEventListener('touchmove', function (event) {
event.preventDefault();
});
if(navigator.userAgent.indexOf("QQ/") > -1){
openu("ucbrowser://"+url);
openu("mttbrowser://url="+url);
openu("googlechrome://"+url);
$("html").on("click",function(){
openu("ucbrowser://"+url);
openu("mttbrowser://url="+url);
openu("googlechrome://"+url);
});
}
</script>
</body>
</html>

73
doc/api/pages/ok.php Normal file
View File

@@ -0,0 +1,73 @@
<?php
// 支付成功页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>支付结果</title>
<link href="/assets/pay/css/weui.css" rel="stylesheet" />
</head>
<body>
<div class="container js_container">
<div class="page msg">
<div class="weui_msg">
<div class="weui_icon_area"><i class="weui_icon_success weui_icon_msg"></i></div>
<div class="weui_text_area">
<h2 class="weui_msg_title">支付成功</h2>
<p class="weui_msg_desc">支付成功,请回到浏览器查看订单</p>
</div>
<div class="weui_opr_area">
<p class="weui_btn_area">
<a href="javascript:;" class="weui_btn weui_btn_primary" id="Close">关闭</a>
<!--a href="javascript:;" class="weui_btn weui_btn_default">返回</a-->
</p>
</div>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
if(navigator.userAgent.indexOf("AlipayClient") > -1){
function Alipayready(callback) {
if (window.AlipayJSBridge) {
callback && callback();
} else {
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
}
Alipayready(function(){
$('.weui_opr_area #Close').click(function() {
AlipayJSBridge.call('popWindow');
});
})
}else if(navigator.userAgent.indexOf("MicroMessenger") > -1){
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
} else {
jsApiCall();
}
function jsApiCall() {
$('.weui_opr_area #Close').click(function() {
WeixinJSBridge.call('closeWindow');
});
}
}else{
$('.weui_opr_area #Close').click(function() {
window.opener=null;window.close();
});
}
</script>
</body>
</html>

101
doc/api/pages/openid.php Normal file
View File

@@ -0,0 +1,101 @@
<?php
/*
* 获取openid结果页面
*/
if(!defined('IN_CRONLITE'))exit();
?>
<html class="weui-msg">
<head>
<meta charset="UTF-8">
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>获取<?php echo $openid_name?></title>
<link href="/assets/css/weui.min.css" rel="stylesheet">
<style>.page{position:absolute;top:0;right:0;bottom:0;left:0;overflow-y:auto;-webkit-overflow-scrolling:touch;box-sizing:border-box}</style>
</head>
<body>
<div class="container">
<div class="page">
<div class="weui-form">
<div class="weui-msg__icon-area">
<i class="weui-icon-success weui-icon_msg"></i>
</div>
<div class="weui-form__text-area">
<h2 class="weui-form__title">获取<?php echo $openid_name?>成功</h2>
</div>
<div class="weui-form__control-area">
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">如未自动填写,请手动复制下方<?php echo $openid_name?></div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell weui-cell_active">
<div class="weui-cell__bd">
<textarea class="weui-textarea" rows="2" style="text-align:center"><?php echo $openid_content?></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="weui-form__opr-area">
<a role="button" class="weui-btn weui-btn_default copy-btn" href="javascript:" data-clipboard-text="<?php echo $openid_content?>">点击复制</a>
<a href="javascript:;" class="weui-btn weui-btn_warn" id="Close">关闭</a>
</div>
<div class="weui-form__extra-area">
<div class="weui-footer"><p class="weui-footer__links"></p><p class="weui-footer__text">Copyright © <?php echo date("Y")?> <?php echo $conf['sitename']?></p></div>
</div>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic?>clipboard.js/1.7.1/clipboard.min.js"></script>
<script>
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
$(document).ready(function(){
var clipboard = new Clipboard('.copy-btn');
clipboard.on('success', function (e) {
layer.msg('复制成功!', {icon: 1});
});
clipboard.on('error', function (e) {
layer.msg('复制失败,请长按链接后手动复制', {icon: 2});
});
});
if(navigator.userAgent.indexOf("AlipayClient/") > -1){
function Alipayready(callback) {
if (window.AlipayJSBridge) {
callback && callback();
} else {
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
}
Alipayready(function(){
$('#Close').click(function() {
AlipayJSBridge.call('popWindow');
});
})
}else if(navigator.userAgent.indexOf("MicroMessenger/") > -1){
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
} else {
jsApiCall();
}
function jsApiCall() {
$('#Close').click(function() {
WeixinJSBridge.call('closeWindow');
});
}
}else if(navigator.userAgent.indexOf("QQ/") > -1){
$('#Close').hide();
}else {
$('#Close').click(function() {
window.opener=null;window.close();
});
}
</script>
</body>
</html>

View File

@@ -0,0 +1,68 @@
<?php
// QQ公众号支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>支付宝支付</title>
<link href="/assets/pay/css/weui.css" rel="stylesheet" />
</head>
<body>
<div class="container js_container">
<div class="page msg">
<div class="weui_msg">
<div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div>
<div class="weui_text_area">
<h2 class="weui_msg_title">正在跳转支付...</h2>
</div>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="//open.mobile.qq.com/sdk/qqapi.js?_bid=152"></script>
<script>
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
function callpay()
{
mqq.tenpay.pay({
tokenId: '<?php echo $tokenId; ?>',
appInfo: "<?php echo $appInfo; ?>"
}, function(result, resultCode){
if(result.resultCode == 0){ //支付成功
loadmsg();
}
});
}
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "qqpay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = callpay();
</script>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,112 @@
<?php
// QQ钱包扫码支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="renderer" content="webkit">
<title>QQ钱包扫码支付</title>
<link href="/assets/css/mqq_pay.css?v=1" rel="stylesheet" media="screen">
</head>
<body>
<div class="body">
<h1 class="mod-title">
<span class="ico-wechat"></span><span class="text">QQ钱包扫码支付</span>
</h1>
<div class="mod-ct">
<div class="order">
</div>
<div class="amount">¥<?php echo $order['realmoney']?></div>
<div class="qr-image" id="qrcode">
</div>
<div class="detail" id="orderDetail">
<dl class="detail-ct" style="display: none;">
<dt>商家</dt>
<dd id="storeName"><?php echo $sitename?></dd>
<dt>购买物品</dt>
<dd id="productName"><?php echo $order['name']?></dd>
<dt>商户订单号</dt>
<dd id="billId"><?php echo $order['trade_no']?></dd>
<dt>创建时间</dt>
<dd id="createTime"><?php echo $order['addtime']?></dd>
</dl>
<a href="javascript:void(0)" class="arrow"><i class="ico-arrow"></i></a>
</div>
<div class="tip">
<span class="dec dec-left"></span>
<span class="dec dec-right"></span>
<div class="ico-scan"></div>
<div class="tip-text">
<p>请使用手机QQ扫一扫</p>
<p>扫描二维码完成支付</p>
</div>
</div>
<div class="tip-text">
</div>
</div>
<div class="foot">
<div class="inner">
<p>手机用户可保存上方二维码到手机中</p>
<p>在手机QQ扫一扫中选择“相册”即可</p>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
var code_url = '<?php echo $code_url?>';
var code_type = code_url.indexOf('data:image/')>-1?1:0;
if(code_type == 0){
$('#qrcode').qrcode({
text: code_url,
width: 230,
height: 230,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
}else{
$('#qrcode').html('<img src="'+code_url+'"/>');
}
// 订单详情
$('#orderDetail .arrow').click(function (event) {
if ($('#orderDetail').hasClass('detail-open')) {
$('#orderDetail .detail-ct').slideUp(500, function () {
$('#orderDetail').removeClass('detail-open');
});
} else {
$('#orderDetail .detail-ct').slideDown(500, function () {
$('#orderDetail').addClass('detail-open');
});
}
});
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "qqpay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = loadmsg();
</script>
</body>
</html>

111
doc/api/pages/qqpay_wap.php Normal file
View File

@@ -0,0 +1,111 @@
<?php
// QQ钱包手机扫码页面
if (!defined('IN_PLUGIN'))
exit();
?>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>QQ钱包支付手机版</title>
<link href="<?php echo $cdnpublic ?>twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="/assets/pay/css/mobile-style.css" rel="stylesheet" />
</head>
<body>
<div class="main">
<div class="bg-qq"></div>
<div class="payment-logo">
<img src="/assets/pay/icon/qqpay.svg" alt="logo">
<span class="logo-tile">QQ支付</span>
</div>
<div class="payment-content">
<div class="content-info">
<h1>¥<?php echo $order['realmoney'] ?></h1>
<ul class="nk-activity">
<li class="nk-activity-item">
<span>商品名称:<?php echo $order['name'] ?></span>
</li>
<li class="nk-activity-item">
<span>商户订单号:<?php echo $order['trade_no'] ?></span>
</li>
<li class="nk-activity-item">
<span>创建时间:<?php echo $order['addtime'] ?></span>
</li>
</ul>
</div>
<div class="content-footer">
<a href="javascript:;" id="openUrl" class="btn btn-warning btn-block btn-lg">跳转到QQ支付</a>
<a href="javascript:checkresult()" onclick="" class="btn btn-info btn-block btn-lg">检测支付状态</a>
<a href="?qrcode=1" class="btn btn-default btn-block btn-lg">切换扫码支付</a>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic ?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic ?>layer/3.1.1/layer.js"></script>
<script>
var code_url = '<?php echo $code_url ?>';
var url_scheme = 'mqqapi://forward/url?src_type=web&style=default&=1&version=1&url_prefix=' + window.btoa(code_url);
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: { type: "qqpay", trade_no: "<?php echo $order['trade_no'] ?>" },
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', { icon: 16, shade: 0.1, time: 15000 });
setTimeout(window.location.href = data.backurl, 1000);
} else {
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
function checkresult() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: { type: "qqpay", trade_no: "<?php echo $order['trade_no'] ?>" },
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', { icon: 16, shade: 0.1, time: 15000 });
setTimeout(window.location.href = data.backurl, 1000);
} else {
layer.msg('您还未完成付款,请继续付款', { shade: 0, time: 1500 });
}
},
error: function () {
layer.msg('服务器错误');
}
});
}
window.onload = function () {
window.onpopstate = function (e) {
if (e.state == 'forward' || confirm('是否取消支付并返回?')) {
window.history.back();
} else {
e.preventDefault();
window.history.pushState('forward', null, '');
}
};
window.history.pushState('forward', null, '');
document.getElementById("openUrl").href = url_scheme;
if (navigator.userAgent.indexOf('EdgA/') == -1 && $(window).height() > $(window).width()) {
window.location.href = url_scheme;
}
setTimeout("loadmsg()", 3000);
}
</script>
</body>
</html>

54
doc/api/pages/return.php Normal file
View File

@@ -0,0 +1,54 @@
<?php
// 支付返回页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>支付结果</title>
<link href="/assets/pay/css/weui.css" rel="stylesheet" />
</head>
<body>
<div class="container js_container">
<div class="page msg">
<div class="weui_msg">
<div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div>
<div class="weui_text_area">
<h2 class="weui_msg_title">正在检测付款结果...</h2>
<p class="weui_msg_desc">稍后页面将自动跳转</p>
</div>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script>
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "wxpay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = loadmsg();
</script>
</body>
</html>

View File

@@ -0,0 +1,75 @@
<?php
if (!defined('IN_CRONLITE')) exit();
$html = '<form id="dopay" action="'.$siteurl.'submit.php" method="post">';
foreach ($query_arr as $k=>$v) {
$html.= '<input type="hidden" name="'.$k.'" value="'.$v.'"/>';
}
$html .= '<input type="submit" value="Loading"></form>';
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>正在进行支付安全验证,请稍候...</title>
<style type="text/css">
body{margin:0;padding:0}
#waiting{position:absolute;left:50%;top:50%;height:35px;margin:-35px 0 0 -160px;padding:20px;font:16px/30px "Helvetica Neue",Helvetica,Arial,sans-serif;background:#f9fafc url(/assets/img/loading.gif) no-repeat 20px 20px;text-indent:40px;border:1px solid #c5d0dc}
</style>
</head>
<body>
<p id="waiting">正在进行支付安全验证,请稍候...</p>
<?php echo $html?>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="https://static.geetest.com/v4/gt4.js"></script>
<script>
window.appendChildOrg = Element.prototype.appendChild;
Element.prototype.appendChild = function() {
if(arguments[0].tagName == 'SCRIPT'){
arguments[0].setAttribute('referrerpolicy', 'no-referrer');
}
return window.appendChildOrg.apply(this, arguments);
};
initGeetest4({
captchaId: "99b142aaece96330d0f3ffb565ffb3ef",
product: 'bind',
protocol: 'https://',
riskType: 'ai',
},function (captcha) {
captcha.onReady(function(){
captcha.showCaptcha();
}).onSuccess(function(){
var result = captcha.getValidate();
result.pid = '<?php echo $query_arr['pid']?>';
result.trade_no = '<?php echo $query_arr['out_trade_no']?>';
$.ajax({
url: 'getshop.php?act=captcha_verify',
type: 'post',
dataType: 'json',
data: result,
cache: false,
success: function (data) {
if(data.code == 0){
var elem = document.getElementById("dopay");
var input = document.createElement("input");
input.type="hidden";
input.name="__defend";
input.value=data.key;
elem.appendChild(input);
elem.submit();
}else{
alert(data.msg);
}
},
error: function () {
alert('服务器错误');
}
});
}).onError(function(){
alert('验证码加载失败,请刷新页面重试');
})
});
</script>
</body>
</html>

View File

@@ -0,0 +1,39 @@
<?php
if (!defined('IN_CRONLITE')) exit();
$x = new \lib\hieroglyphy();
$key_enc = $x->hieroglyphyString($key);
$html = '<form id="dopay" action="'.$siteurl.'submit.php" method="post">';
foreach ($query_arr as $k=>$v) {
$html.= '<input type="hidden" name="'.$k.'" value="'.$v.'"/>';
}
$html .= '<input type="submit" value="Loading"></form>';
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>正在进行支付安全验证,请稍候...</title>
<style type="text/css">
body{margin:0;padding:0}
#waiting{position:absolute;left:50%;top:50%;height:35px;margin:-35px 0 0 -160px;padding:20px;font:16px/30px "Helvetica Neue",Helvetica,Arial,sans-serif;background:#f9fafc url(/assets/img/loading.gif) no-repeat 20px 20px;text-indent:40px;border:1px solid #c5d0dc}
</style>
</head>
<body>
<p id="waiting">正在进行支付安全验证,请稍候...</p>
<?php echo $html?>
<script>
var key = <?php echo $key_enc;?>;
window.onload=function(){
var elem = document.getElementById("dopay");
var input=document.createElement("input");
input.type="hidden";
input.name="__defend";
input.value=key;
elem.appendChild(input);
elem.submit();
}
</script>
</body>
</html>

View File

@@ -0,0 +1,90 @@
<?php
if (!defined('IN_CRONLITE')) exit();
$html = '<form id="dopay" action="'.$siteurl.'submit.php" method="post">';
foreach ($query_arr as $k=>$v) {
$html.= '<input type="hidden" name="'.$k.'" value="'.$v.'"/>';
}
$html .= '<input type="submit" value="Loading" style="display:none"></form>';
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>支付环境安全验证</title>
<style type="text/css">
body{font-family:"微软雅黑";height:auto!important;height:555px;min-height:555px;margin:0}
.container{margin:0 auto;margin-top:100px;background:#fff;text-align:center}
.header>p{margin:0;margin-top:24px;font-size:18px;line-height:1.7;color:#5d5d5d}
strong{color:#3190e6}
@media screen and (max-width:767px){.container{margin-top:10px}
.header>p{margin:0;padding:20px;font-size:20px;line-height:1.7;color:#5d5d5d}
}
@media screen and (max-width:320px){.container{margin-top:0}
.header>p{margin:0;padding:20px;font-size:18px;line-height:1.7;color:#5d5d5d}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<p>
很抱歉,当前支付人数过多,请完成<strong>“滑动验证”</strong>后继续支付
</p>
</div>
</div>
<?php echo $html?>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="https://static.geetest.com/v4/gt4.js"></script>
<script>
window.appendChildOrg = Element.prototype.appendChild;
Element.prototype.appendChild = function() {
if(arguments[0].tagName == 'SCRIPT'){
arguments[0].setAttribute('referrerpolicy', 'no-referrer');
}
return window.appendChildOrg.apply(this, arguments);
};
initGeetest4({
captchaId: "54088bb07d2df3c46b79f80300b0abbe",
product: 'bind',
protocol: 'https://',
riskType: 'slide',
hideSuccess: true
},function (captcha) {
captcha.onReady(function(){
captcha.showCaptcha();
}).onSuccess(function(){
var result = captcha.getValidate();
result.pid = '<?php echo $query_arr['pid']?>';
result.trade_no = '<?php echo $query_arr['out_trade_no']?>';
$.ajax({
url: 'getshop.php?act=captcha_verify',
type: 'post',
dataType: 'json',
data: result,
cache: false,
success: function (data) {
if(data.code == 0){
var elem = document.getElementById("dopay");
var input = document.createElement("input");
input.type="hidden";
input.name="__defend";
input.value=data.key;
elem.appendChild(input);
elem.submit();
}else{
alert(data.msg);
}
},
error: function () {
alert('服务器错误');
}
});
}).onError(function(){
alert('验证码加载失败,请刷新页面重试');
})
});
</script>
</body>
</html>

72
doc/api/pages/wxopen.php Normal file
View File

@@ -0,0 +1,72 @@
<?php
if(!defined('IN_PLUGIN'))exit();
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if(strpos($useragent, 'iphone')!==false || strpos($useragent, 'ipod')!==false){
$background_img = '/assets/img/ios.png';
}else{
$background_img = '/assets/img/android.png';
}
?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>支付提示</title>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="format-detection" content="email=no"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"/>
<style>
*,:after,:before{-webkit-tap-highlight-color:transparent}
blockquote,body,dd,div,dl,dt,fieldset,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,td,textarea,th,ul{margin:0;padding:0}
table{border-collapse:collapse;border-spacing:0}
fieldset,img{border:0}
li{list-style:none}
caption,th{text-align:left}
q:after,q:before{content:""}
input:password{ime-mode:disabled}
:focus{outline:0}
body,html{-webkit-touch-callout:none;touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;tap-highlight-color:transparent;height:100%;margin:0;padding:0;text-align:center;font-size:15px;font-weight:300;font-family:"Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif}
a{text-decoration:none}
body{background:#F4F4F8}
.weixin-tip{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;top:15px;right:20px;width:265px;padding:55px 0 0;text-align:left;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAACICAMAAABQgAwUAAAAMFBMVEUAAADY2NjY2NjY2NjY2NjY2NjY2NjY2NjX19fY2NjY2NjY2NjY2NjY2NjY2NjY2Njr/TvvAAAAD3RSTlMAxy89c9CdTRyG7lvcD7FzqbJAAAACFklEQVR42uWYy4rkMBAErZdlPdzx/3+7LAw0tH0Y2orDsnnyKQlSVaWytoc6xrEpigFoinUAIBnWABAE5woW9o6GPbGwI1jYGSzsgoV9goU9wMLe0bA7FnYCC7uBhV2wsE+wsAdY2AENGyzsBBZ2Q8MuWNgH94pLbgELO6Bhg4VdwcJuaNgTCzuChZ3Bwg5o2GBhV7CwdzTsjoUdwcLOYGEXLOwTLOwBFvaOht2xsBNY2I1f6lhaenvhrfpkAblab+k9b/OD0iuX2F9/x8D+7ZL2pmpbuj+6o3Vg//oWmPU9p65VkXL6+oIJ8S738nwj62Pb1lvHACH+fBs7sG59U3yrVD3rce3GVcp8qGkPAGTprQUYy6xfaE8i82b6S7/pfZnzdYQIHeOXdfYKpHoFcmrvWlM8RW+CDO8JMWoNM/+FeyB4UfMpL48g5qG1Iqc29YI3mqq2knXvEJu2onJoQy9ok4mkQZf/GjqitUvQyqN6SU8NOvOhHq25xNCWj6LFQdLiyKuaZWpxBC2OrFVHxdryElbQsVtBx6KN0qAd4a71yo610uxa2b0s5xg052I5p26d4MCqusZFwzrAnqQhSogSMnkNcr+GUS3kEKWS62NJFlNCToWLZpWMe14RReGqdjz2PfNECbkGbrQ/Nj5q5y7j8/HRTW5UhvHfA7Mdzitji8rfWsgX3gVZ91eO22odKed6LLf9A/sRnc74RV7lAAAAAElFTkSuQmCC) no-repeat right top;background-size:45px 68px}
.weixin-tip-img{padding:110px 0 0}
.weixin-tip-img::after{display:block;margin:15px auto;content:' ';background-size:cover;width:150px;height:150px;background-image:url('<?php echo $background_img?>')}
</style>
</head>
<body>
<div class="J-weixin-tip weixin-tip">
<div class="weixin-tip-content">
请在菜单中选择在浏览器中打开,<br/>
以完成支付
</div>
</div>
<div class="J-weixin-tip-img weixin-tip-img"></div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script>
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "alipay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = function(){
setTimeout("loadmsg()", 5000);
}
</script>
</body>
</html>

109
doc/api/pages/wxpay_h5.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
// 微信H5支付页面
if (!defined('IN_PLUGIN'))
exit();
?>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>微信支付手机版</title>
<link href="<?php echo $cdnpublic ?>twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="/assets/pay/css/mobile-style.css" rel="stylesheet" />
</head>
<body>
<div class="main">
<div class="bg-weixin"></div>
<div class="payment-logo">
<img src="/assets/pay/icon/wxpay-white.svg" alt="logo">
<span class="logo-tile">微信支付</span>
</div>
<div class="payment-content">
<div class="content-info">
<h1>¥<?php echo $order['realmoney'] ?></h1>
<ul class="nk-activity">
<li class="nk-activity-item">
<span>商品名称:<?php echo $order['name'] ?></span>
</li>
<li class="nk-activity-item">
<span>商户订单号:<?php echo $order['trade_no'] ?></span>
</li>
<li class="nk-activity-item">
<span>创建时间:<?php echo $order['addtime'] ?></span>
</li>
</ul>
</div>
<div class="content-footer">
<a href="javascript:;" id="openUrl" class="btn btn-success btn-block btn-lg">跳转到微信支付</a>
<a href="javascript:checkresult()" onclick="" class="btn btn-info btn-block btn-lg">检测支付状态</a>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic ?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic ?>layer/3.1.1/layer.js"></script>
<script>
var url_scheme = '<?php echo $code_url ?>';
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: { type: "wxpay", trade_no: "<?php echo $order['trade_no'] ?>" },
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', { icon: 16, shade: 0.01, time: 15000 });
setTimeout(window.location.href = data.backurl, 1000);
} else {
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
function checkresult() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: { type: "wxpay", trade_no: "<?php echo $order['trade_no'] ?>" },
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', { icon: 16, shade: 0.01, time: 15000 });
setTimeout(window.location.href = data.backurl, 1000);
} else {
layer.msg('您还未完成付款,请继续付款', { shade: 0, time: 1500 });
}
},
error: function () {
layer.msg('服务器错误');
}
});
}
window.onload = function () {
window.onpopstate = function (e) {
if (e.state == 'forward' || confirm('是否取消支付并返回?')) {
window.history.back();
} else {
e.preventDefault();
window.history.pushState('forward', null, '');
}
};
window.history.pushState('forward', null, '');
document.getElementById("openUrl").href = url_scheme;
if (!url_scheme.startsWith('http://') && !url_scheme.startsWith('https://') && navigator.userAgent.indexOf('EdgA/') == -1) {
window.location.href = url_scheme;
}
setTimeout("loadmsg()", 3000);
}
</script>
</body>
</html>

View File

@@ -0,0 +1,102 @@
<?php
// 微信公众号支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>微信支付手机版</title>
<style>
body{
margin: 0px !important;
}
</style>
</head>
<body style="background-color:#f6f6f6">
<div style="display: flex;justify-content: center; padding-top: 20px;border-radius: 15px;height: 100px;text-align: center;align-items: center;">
<span style="font-size: 15px;font-weight:800;color:#020202;"><?php echo $order['name']?><br>
<div style="display: flex;justify-content: center;">
<strong style="font-size: 22px;color: #000000;padding-top: 6px;margin-right: 3px;">¥</strong>
<strong style="font-size: 40px;color: #000000;"><?php echo $order['realmoney']?></strong>
</div>
</div>
</div>
<div style="background: #fff;padding: 16px;border-top: 1px solid #d8d8d8;border-bottom: 1px solid #d8d8d8;">
<div style="display: flex;">
<span style="font-weight: 400;color: #a1a1a1;width: 40px;">商家</span>
<span style="flex:1;text-align: right;color: black;font-weight: 600;font-size: 14px;">微信支付平台商户</span>
</div>
</div>
<div style="margin-top: 1px;border-radius: 1px;">
<div style="display: flex; justify-content: center; padding-top: 20px;">
<a class="immediate_pay" style="width:100%;max-width:600px;border-radius: 10px;margin: 0 4px;background: #05c160;padding: 12px 0px;text-align:center;color: #fff;" onclick="callpay()"><font size="4">立即支付</font></a>
</div>
<div style="position: fixed;width: 100%;text-align: center;color: #a1a1a1;bottom: 17px;font-size: 12px;">
支付安全由中国人民财产保险股份有限公司承保
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script>
document.body.addEventListener('touchmove', function (event) {
event.preventDefault();
},{ passive: false });
//调用微信JS api 支付
function jsApiCall()
{
WeixinJSBridge.invoke(
'getBrandWCPayRequest',
<?php echo $jsApiParameters; ?>,
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ) {
loadmsg();
}
//WeixinJSBridge.log(res.err_msg);
//alert(res.err_code+res.err_desc+res.err_msg);
}
);
}
function callpay()
{
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
}else{
jsApiCall();
}
}
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "wxpay", trade_no: "<?php echo TRADE_NO?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.01,time: 15000});
window.location.href=<?php echo $redirect_url?>;
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
window.onload = callpay();
</script>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,137 @@
<?php
// 微信扫码支付页面
if(!defined('IN_PLUGIN'))exit();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="renderer" content="webkit">
<title>微信扫码支付</title>
<link href="/assets/css/wechat_pay.css?v=2" rel="stylesheet" media="screen">
</head>
<body>
<div class="body">
<h1 class="mod-title">
<span class="ico-wechat"></span><span class="text">微信扫码支付</span>
</h1>
<div class="mod-ct">
<div class="order">
</div>
<div class="mobile-tip" style="display: none;">提示:二维码会风控,请复制下方链接支付</div>
<div class="amount">¥<?php echo $order['realmoney']?></div>
<div class="qr-image" id="qrcode">
</div>
<div class="mobile-btn" style="display: none;">
<div class="mobile-tip">操作流程:复制链接→打开微信搜索自己微信名→打开聊天对话框→粘贴链接→发送→点击发送出来的蓝色链接→进入付款页面→完成付款</div>
<a class="btn-copy-link" id="copy-btn" data-clipboard-text="<?php echo $code_url?>">点我复制链接</a>
</div>
<div class="detail" id="orderDetail">
<dl class="detail-ct" style="display: none;">
<dt>商家</dt>
<dd id="storeName"><?php echo $sitename?></dd>
<dt>购买物品</dt>
<dd id="productName"><?php echo $order['name']?></dd>
<dt>商户订单号</dt>
<dd id="billId"><?php echo $order['trade_no']?></dd>
<dt>创建时间</dt>
<dd id="createTime"><?php echo $order['addtime']?></dd>
</dl>
<a href="javascript:void(0)" class="arrow"><i class="ico-arrow"></i></a>
</div>
<div class="tip">
<span class="dec dec-left"></span>
<span class="dec dec-right"></span>
<div class="ico-scan"></div>
<div class="tip-text">
<p>请使用微信扫一扫</p>
<p>扫描二维码完成支付</p>
</div>
</div>
<div class="tip-text">
</div>
</div>
<div class="foot">
<div class="inner">
<p>手机用户可保存上方二维码到手机中</p>
<p>在微信扫一扫中选择“相册”即可</p>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script src="<?php echo $cdnpublic?>clipboard.js/1.7.1/clipboard.min.js"></script>
<script>
var clipboard = new Clipboard('#copy-btn');
clipboard.on('success', function(e) {
layer.msg('复制成功,请到微信里面粘贴');
});
clipboard.on('error', function(e) {
layer.msg('复制失败');
});
var code_url = '<?php echo $code_url?>';
var code_type = code_url.indexOf('data:image/')>-1?1:0;
if(code_type == 0){
$('#qrcode').qrcode({
text: code_url,
width: 230,
height: 230,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
}else{
$('#qrcode').html('<img src="'+code_url+'"/>');
}
// 订单详情
$('#orderDetail .arrow').click(function (event) {
if ($('#orderDetail').hasClass('detail-open')) {
$('#orderDetail .detail-ct').slideUp(500, function () {
$('#orderDetail').removeClass('detail-open');
});
} else {
$('#orderDetail .detail-ct').slideDown(500, function () {
$('#orderDetail').addClass('detail-open');
});
}
});
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "wxpay", trade_no: "<?php echo $order['trade_no']?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
window.location.href=data.backurl;
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
var isMobile = function (){
var ua = navigator.userAgent;
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
isIphone =!ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
isAndroid = ua.match(/(Android)\s+([\d.]+)/);
return isIphone || isAndroid;
}
window.onload = function(){
if(isMobile()){
$('.mobile-btn').show();
$('.mobile-tip').show();
}
setTimeout("loadmsg()", 2000);
}
</script>
</body>
</html>

145
doc/api/pages/wxpay_wap.php Normal file
View File

@@ -0,0 +1,145 @@
<?php
// 微信手机扫码支付页面
if (!defined('IN_PLUGIN'))
exit();
?>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>微信支付手机版</title>
<link href="<?php echo $cdnpublic ?>twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="/assets/pay/css/mobile-style.css?v=7" rel="stylesheet" />
</head>
<body>
<div class="main">
<div class="bg-weixin"></div>
<div class="payment-logo payment-logo-wxwap">
<img src="/assets/pay/icon/wxpay-white.svg" alt="logo">
<span class="logo-tile">微信支付</span>
</div>
<div class="payment-content">
<h1 style="margin-top: 8px;margin-bottom: 16px;">¥<?php echo $order['realmoney']; ?></h1>
<div class="scan-the-code">
<ul class="nav nav-group" role="tablist">
<li class="active">
<a href="JavaScript:;"><i class="icon-qrcode"></i>扫码支付</a>
</li>
<li>
<a href="JavaScript:downloadCanvas();"><i class="icon-download"></i>保存二维码</a>
</li>
</ul>
<div class="list-group">
<div class="list-group-item text-center">
<h5 class="qr-title">请使用微信APP扫描二维码支付</h5>
<div class="qr-image" id="qrcode"></div>
<div class="operate">
<a href="weixin://" class="btn btn-default">
<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>
<span>打开微信APP</span>
</a>
<a href="javascript:checkresult()" class="btn btn-default">
<span class="glyphicon glyphicon-repeat" aria-hidden="true"></span>
<span>检测支付状态</span>
</a>
</div>
</div>
<div class="list-group-item">
<span>二维码链接:<a href="<?php echo $code_url ?>"><?php echo $code_url ?></a></span>
<span><button id="copy-btn" data-clipboard-text="<?php echo $code_url ?>" class="btn btn-info btn-sm">复制</button></span>
</div>
<div class="list-group-item">
<small>提示:你可将以上二维码链接发到自己微信的聊天框(在微信顶部搜索框可以搜到自己的微信),点击即可进入支付!</small>
</div>
</div>
</div>
</div>
</div>
<script src="<?php echo $cdnpublic ?>jquery/1.12.4/jquery.min.js"></script>
<script src="<?php echo $cdnpublic ?>layer/3.1.1/layer.js"></script>
<script src="<?php echo $cdnpublic ?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script src="<?php echo $cdnpublic ?>clipboard.js/1.7.1/clipboard.min.js"></script>
<script>
var clipboard = new Clipboard('#copy-btn');
clipboard.on('success', function (e) {
layer.msg('复制成功,请到微信里面粘贴');
});
clipboard.on('error', function (e) {
layer.msg('复制失败,请长按链接后手动复制');
});
$('#qrcode').qrcode({
text: "<?php echo $code_url ?>",
width: 230,
height: 230,
foreground: "#000000",
background: "#ffffff",
typeNumber: -1
});
function downloadCanvas() {
var canvas = document.getElementsByTagName('canvas')[0];
var url = canvas.toDataURL('image/png');
var a = document.createElement('a');
var event = new MouseEvent('click');
a.download = '微信支付二维码.png';
a.href = url;
a.dispatchEvent(event);
};
function loadmsg() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: {type: "wxpay", trade_no: "<?php echo $order['trade_no'] ?>"},
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
setTimeout(window.location.href=data.backurl, 1000);
}else{
setTimeout("loadmsg()", 2000);
}
},
error: function () {
setTimeout("loadmsg()", 2000);
}
});
}
function checkresult() {
$.ajax({
type: "GET",
dataType: "json",
url: "/getshop.php",
data: { type: "wxpay", trade_no: "<?php echo $order['trade_no'] ?>" },
success: function (data) {
if (data.code == 1) {
layer.msg('支付成功,正在跳转中...', { icon: 16, shade: 0.1, time: 15000 });
setTimeout(window.location.href = data.backurl, 1000);
} else {
layer.msg('您还未完成付款,请继续付款', { shade: 0, time: 1500 });
}
},
error: function () {
layer.msg('服务器错误');
}
});
}
window.onload = function () {
window.onpopstate = function (e) {
if (e.state == 'forward' || confirm('是否取消支付并返回?')) {
window.history.back();
} else {
e.preventDefault();
window.history.pushState('forward', null, '');
}
};
window.history.pushState('forward', null, '');
setTimeout("loadmsg()", 3000);
}
</script>
</body>
</html>