页面跳转支付
此接口可用于用户前台直接发起支付,使用 form 表单跳转或拼接成 URL 跳转。
接口信息
POST
https://epay.trycode.net/api/pay/submit
请求方式:POST 或 GET(推荐 POST,不容易被劫持)
请求参数
| 字段名 | 变量名 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
| 商户ID | pid |
是 | Int | 商户ID,由系统分配 |
| 支付方式 | type |
是 | String | 支付方式列表 |
| 商户订单号 | out_trade_no |
是 | String | 商户系统内的订单号,需确保唯一 |
| 异步通知地址 | notify_url |
是 | String | 服务器异步通知地址 |
| 跳转通知地址 | return_url |
是 | String | 页面跳转通知地址 |
| 商品名称 | name |
是 | String | 商品名称,如超过127字节会自动截取 |
| 商品金额 | money |
是 | String | 单位:元,最大2位小数 |
| 业务扩展参数 | param |
否 | String | 支付后原样返回 |
| 签名字符串 | sign |
是 | String | 签名算法 |
| 签名类型 | sign_type |
是 | String | RSA2 或 MD5 |
提示
不传支付方式(type)参数时,会跳转到收银台页面让用户选择支付方式。
代码示例
<form action="https://epay.trycode.net/api/pay/submit" method="post">
<input type="hidden" name="pid" value="1001">
<input type="hidden" name="type" value="alipay">
<input type="hidden" name="out_trade_no" value="20230101120000001">
<input type="hidden" name="notify_url" value="https://www.example.com/notify.php">
<input type="hidden" name="return_url" value="https://www.example.com/return.php">
<input type="hidden" name="name" value="测试商品">
<input type="hidden" name="money" value="1.00">
<input type="hidden" name="sign" value="签名字符串">
<input type="hidden" name="sign_type" value="RSA2">
<button type="submit">立即支付</button>
</form>