简要描述
- 代收下单接口
请求信息
请求 URL
javascripthttps://www.xxx.com/gateway/recharge请求规范
基础信息
- 接口协议:
HTTPS - 数据格式:
application/json - 请求方式:
POST
- 接口协议:
请求示例
typescript// typescript + axios 请求示例 import axios from 'axios' // 定义请求参数类型 interface CreateOrderParams { merchant_no: string order_no: string amount: string remark: string customer: string ip: string callback_url: string return_url: string time: string sign: string } // 示例函数:发送订单创建请求 async function createOrder(params: CreateOrderParams) { try { const response = await axios.post('https://api.example.com/gateway/recharge', params) console.log('Success:', response.data) return response.data } catch (error: any) { if (error.response) { // 服务端返回的错误响应 console.error('API Error:', error.response.data) } else { // 网络错误或其他问题 console.error('Request Failed:', error.message) } throw error } } // 示例调用 createOrder({ merchant_no: 'M1234567890', order_no: 'ORD1234567890', amount: '100.00', remark: 'Test order', customer: 'user123', ip: '192.168.1.1', callback_url: 'https://yourapp.com/callback', return_url: 'https://yourapp.com/return', time: Date.now().toString(), sign: 'your_generated_signature_here' })
请求参数列表
参数名 必选 类型 说明 merchant_no ✅ string 商户号 order_no ✅ string 商户订单号 amount ✅ string 金额 remark ✅ string 备注 customer ✅ string 用户id ip ✅ string 用户ip callback_url ✅ string 成功回调地址 return_url ✅ string 成功跳转地址 time ✅ string 时间戳 sign ✅ string sign
响应信息
响应示例
json
{
"code": "0",
"msg": "",
"data": {
"hash": "def50200d53b9e1f830a35165aeebae8baa18ef3806e5300cf412ec91c08577df3a1d27f00f46197c55c4c66a5dc6f11d1528c96a8b9a5c4a8281a2e577c47384ae036bee45721dea7595a58d89b482eea66e20043dcb79404",
"trade_no": "RR241115223531937981",
"qr_code": "rsn://r/RR241115223531937981",
"url": "https://xxxxxx/?hash=def50200d53b9e1f830a35165aeebae8baa18ef3806e5300cf412ec91c08577df3a1d27f00f46197c55c4c66a5dc6f11d1528c96a8b9a5c4a8281a2e577c47384ae036bee45721dea7595a58d89b482eea66e20043dcb79404",
"pay_timeout": 3600
}
}响应参数列表
参数名 类型 说明 hash string 加密后的订单ID trade_no string 订单号 qr_code string 二维码 url string 跳转链接 pay_timeout number 过期时间(距离订单过期的秒数)
备注
- 更多关于代收下单接口的问题请咨询管理员
- 更新日期: 2024-04-25