Logo 薯芯云 API文档
返回首页

API对接文档

通过API接口,您可以在其他平台(QQ机器人、网站、APP等)调用薯芯云的收款功能

服务正常 RESTful API API Key认证
认证方式 创建订单 查询订单 订单列表 商户余额 今日统计 申请提现 健康检查
认证方式
所有API请求都需要携带 api_key 参数

API密钥在后台 "API密钥" 页面创建。创建后可获得 api_keyapi_secret

GET请求示例:
# 在URL中传递api_key GET /api/v1/query_order.php?api_key=sk_xxxx&order_no=xxx
POST请求示例:
{ "api_key": "sk_xxxx", "title": "商品名称", "amount": 100.00 }
创建订单
创建收款订单,返回支付链接
POST /api/v1/create_order.php 需认证
参数类型必填说明
api_key string 必填 API密钥
title string 必填 商品/订单标题
amount float 必填 订单金额
description string 可选 订单描述
merchant_id int 可选 商户ID(不填用密钥绑定的商户)
expire_minutes int 可选 有效期分钟,默认30
{ "api_key": "sk_xxxx", "title": "测试商品", "amount": 100.00, "description": "API创建订单" }
查询订单
查询订单支付状态
GET /api/v1/query_order.php 需认证
参数类型必填说明
api_key string 必填 API密钥
order_no string 必填 订单号
响应示例:
{ "success": true, "order": { "order_no": "202608241500001234", "title": "测试商品", "amount": "100.00", "status": 1, "status_text": "已支付", "pay_type": "alipay", "trade_no": "202608241500123456", "pay_time": "2026-08-24 15:00:12", "created_at": "2026-08-24 15:00:00" } }
订单列表
获取订单列表,支持分页和筛选
GET /api/v1/order_list.php 需认证
参数类型必填说明
api_key string 必填 API密钥
merchant_id int 可选 商户ID
status int 可选 0:待支付 1:已支付 2:已过期
page int 可选 页码,默认1
limit int 可选 每页条数,默认20,最大100
响应示例:
{ "success": true, "total": 100, "page": 1, "limit": 20, "total_pages": 5, "orders": [ { "order_no": "xxx", "title": "xxx", "amount": "100.00", "status": 1, "status_text": "已支付" } ] }
商户余额
查询商户余额和累计收入
GET /api/v1/merchant_balance.php 需认证
参数类型必填说明
api_key string 必填 API密钥
merchant_id int 可选 商户ID(不填用密钥绑定的)
响应示例:
{ "success": true, "merchant": { "id": 1, "merchant_no": "M202608240001", "name": "商户名称", "balance": "1000.00", "total_income": "5000.00", "deposit_paid": "100.00" } }
今日统计
获取今日订单统计数据
GET /api/v1/stats_today.php 需认证
响应示例:
{ "success": true, "date": "2026-08-24", "stats": { "total_count": 50, "paid_count": 45, "pending_count": 5, "paid_amount": "4500.00", "pending_amount": "500.00" } }
申请提现
申请提现,需要商户已配置收款方式和保证金
POST /api/v1/withdraw_create.php 需认证
参数类型必填说明
api_key string 必填 API密钥
amount float 必填 提现金额
merchant_id int 可选 商户ID
健康检查
检查API服务是否正常运行(无需认证)
GET /api/v1/ping.php 无需认证
响应示例:
{ "success": true, "message": "pong", "time": "2026-08-24 15:00:00", "version": "1.0.0" }
完整对接示例
在其他平台调用API的代码示例
PHP示例:
// 创建订单 $url = 'https://sxyskd.457009.icu/api/v1/create_order.php'; $data = [ 'api_key' => 'sk_xxxx', 'title' => '测试商品', 'amount' => 100.00 ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); $result = json_decode($response, true); if ($result['success']) { echo '支付链接:' . $result['pay_url']; }
Python示例:
# 创建订单 import requests url = 'https://sxyskd.457009.icu/api/v1/create_order.php' data = { 'api_key': 'sk_xxxx', 'title': '测试商品', 'amount': 100.00 } response = requests.post(url, json=data) result = response.json() if result['success']: print(f"支付链接:{result['pay_url']}")
JavaScript示例:
// 创建订单 const response = await fetch('https://sxyskd.457009.icu/api/v1/create_order.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ api_key: 'sk_xxxx', title: '测试商品', amount: 100.00 }) }); const result = await response.json(); console.log(result.pay_url);