DEVELOPER DOCS · 1.0.0

开放 API · 开发者文档

华商城开放 API 对外开放数据接口。统一入口 POST /api.php,body 携带 action 区分端点。商品 · 订单 · 店铺 · 溯源 · 权益 · 佣金 · 授信,一站打通。

16 大能力分组 48 个开放接口 HMAC-SHA256 签名 沙箱环境可试调

交互式 API 文档

Swagger UI 在线浏览全部接口,填入密钥即可 Try it out 直接试调。

打开交互式文档 →

接入指南 & SDK

接入三步、签名算法详解、客户端示例代码、一键生成 SDK。

查看接入指南 →

接入状态

今日端点状态、调用统计与服务健康度实时看板。

查看接入状态 →
QUICK START
三步接入
从申请密钥到发出第一个请求,三分钟完成。
1

申请开发者密钥

登录华商城 → 开发者中心,提交入驻申请。审核通过后签发 X-Api-Key 与 X-Api-Secret,Secret 仅展示一次,请妥善保管。

2

携带鉴权头发请求

每个请求头携带 X-Api-Key + X-Api-Secret。写操作(发货、收款确认等)另需 HMAC 签名。

3

读取数据 / 写入订单

读端点返回商品、订单、店铺、溯源等数据;商家写端点支持发货、确认线下收款,沙箱模式可安全试调。

AUTHENTICATION
鉴权方式
开放 API 采用「密钥对 + 可选 HMAC 签名」双层鉴权。

读端点 · 密钥对

请求头携带 X-Api-Key(开发者中心签发的 Key)与 X-Api-Secret(成对的 Secret,服务端时序安全比较)。

写端点 · HMAC 签名

写操作额外强制 X-Timestamp(秒级时间戳,±300 秒窗口)、X-Nonce(随机串,一次性防重放)、X-Signature(HMAC-SHA256 签名)。

限流与配额

按 Key 每分钟配额(套餐决定),超限返回 429;IP 级每分钟 600 次封顶,防单 IP 高频刷取。

签名算法(写端点)

sign = HMAC-SHA256(api_secret, base),其中 base 用换行符拼接:

base = timestamp + "\n" + nonce + "\n" + HTTP方法 + "\n" + 请求路径 sign = hex( HMAC-SHA256( api_secret, base ) )

其中 timestamp 为秒级时间戳,nonce 为随机串(每次请求不同),HTTP 方法为大写(GET/POST),请求路径为 /api.php。

CODE SAMPLES
示例代码
读端点(以 open.products 商品列表为例)与写端点(以 open.merchant_ship 发货为例)的完整调用示例。

cURL · 读端点(商品列表)

bash
curl -X POST https://vip.wscmall.com/api.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Api-Secret: YOUR_API_SECRET" \
  -d '{"action":"open.products","page":1,"pageSize":20,"sort":"sales"}'

PHP · 写端点(发货,含 HMAC 签名)

php
$ts    = (string)time();
$nonce = bin2hex(random_bytes(16));
$method = 'POST';
$path   = '/api.php';
$base = $ts . "\n" . $nonce . "\n" . $method . "\n" . $path;
$sign = hash_hmac('sha256', $base, $apiSecret);

$headers = [
  'Content-Type: application/json',
  'X-Api-Key: ' . $apiKey,
  'X-Api-Secret: ' . $apiSecret,
  'X-Timestamp: ' . $ts,
  'X-Nonce: ' . $nonce,
  'X-Signature: ' . $sign,
];
$body = json_encode(['action' => 'open.merchant_ship', 'order_id' => 123,
                     'express_company' => '顺丰速运', 'express_no' => 'SF1234567890']);
$ch = curl_init('https://vip.wscmall.com/api.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

Python · 写端点(发货)

python
import hmac, hashlib, time, secrets, requests

ts = str(int(time.time()))
nonce = secrets.token_hex(16)
base = f"{ts}\n{nonce}\nPOST\n/api.php"
sign = hmac.new(api_secret.encode(), base.encode(), hashlib.sha256).hexdigest()

headers = {
    "Content-Type": "application/json",
    "X-Api-Key": api_key,
    "X-Api-Secret": api_secret,
    "X-Timestamp": ts,
    "X-Nonce": nonce,
    "X-Signature": sign,
}
resp = requests.post("https://vip.wscmall.com/api.php",
    json={"action": "open.merchant_ship", "order_id": 123,
          "express_company": "顺丰速运", "express_no": "SF1234567890"},
    headers=headers)
print(resp.json())

Node.js · 写端点(发货)

node.js
const crypto = require('crypto');
const ts = String(Math.floor(Date.now() / 1000));
const nonce = crypto.randomBytes(16).toString('hex');
const base = `${ts}\n${nonce}\nPOST\n/api.php`;
const sign = crypto.createHmac('sha256', apiSecret).update(base).digest('hex');

const resp = await fetch('https://vip.wscmall.com/api.php', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': apiKey,
    'X-Api-Secret': apiSecret,
    'X-Timestamp': ts,
    'X-Nonce': nonce,
    'X-Signature': sign,
  },
  body: JSON.stringify({ action: 'open.merchant_ship', order_id: 123,
    express_company: '顺丰速运', express_no: 'SF1234567890' })
});
console.log(await resp.json());
API REFERENCE
接口清单
按业务能力分组,读 端点仅需密钥对;写 端点另需 HMAC 签名。
商品目录 4 个接口
open.categories 读 商品分类列表
无请求参数(仅需 action 固定值)
open.products 读 商品列表(分页/分类/排序)
page : int pageSize : int category_id : int · 分类过滤 sort : string · 排序
open.product 读 商品详情(含 SKU + 溯源)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID
open.search 读 商品搜索
keyword : string · open.search 必填:搜索关键词 page : int pageSize : int
品牌店铺 1 个接口
open.shops 读 品牌店铺列表
page : int pageSize : int
商家中心 6 个接口
open.merchant_shop 读 商家店铺信息 + 收款方式
无请求参数(仅需 action 固定值)
open.merchant_orders 读 商家订单列表
page : int pageSize : int status : string · merchant_orders / merchant_settlements 可选:状态过滤
open.merchant_order_detail 读 商家订单详情(含明细)
order_id : int · merchant_order_detail / merchant_ship / merchant_confirm_pay 必填
open.merchant_settlements 读 商家对账单列表
page : int pageSize : int period : string · merchant_settlements 可选:账期 status : string · merchant_orders / merchant_settlements 可选:状态过滤
open.merchant_ship 写 商家发货(写)
order_id : int · merchant_order_detail / merchant_ship / merchant_confirm_pay 必填 express_company : string · merchant_ship:快递公司 express_no : string · merchant_ship:快递单号
open.merchant_confirm_pay 写 商家确认线下收款(写)
order_id : int · merchant_order_detail / merchant_ship / merchant_confirm_pay 必填
溯源存证 3 个接口
open.trace 读 商品溯源链查询
trace_code : string · open.trace:溯源码(与 product_id 二选一) product_id : int · open.trace:商品 ID
open.evidence 读 联盟链存证查验
chain_hash : string · open.evidence:链上哈希(与 covenant_name 二选一);open.audit_verify:定向核验单条链哈希 covenant_name : string · open.evidence:存证名称
open.audit_verify 读 资金审计链验链(整链完整性 / 定向核验)
chain_hash : string · open.evidence:链上哈希(与 covenant_name 二选一);open.audit_verify:定向核验单条链哈希 ref_no : string · 定向核验参考号
权益凭证 2 个接口
open.equity 读 权益凭证查询
voucher_no : string · open.equity / open.equity_verify 必填:权益凭证编号
open.equity_verify 读 权益凭证真伪核验
voucher_no : string · open.equity / open.equity_verify 必填:权益凭证编号
分销佣金 2 个接口
open.partner_overview 读 城市合伙人概览(宏观)
无请求参数(仅需 action 固定值)
open.commission_ledger 读 分销佣金账本(本人)
page : int pageSize : int
供应链金融 2 个接口
open.credit 读 供应链金融授信列表(本人)
无请求参数(仅需 action 固定值)
open.credit_status 读 供应链金融申请状态
app_no : string · open.credit_status 必填:供应链金融申请单号
算力账户 3 个接口
open.agent_credit 读 算力账户余额(本人)
无请求参数(仅需 action 固定值)
open.agent_team_credit 读 团队算力余额(本人)
无请求参数(仅需 action 固定值)
open.agent_recharge_list 读 算力进货/充值流水(本人)
page : int pageSize : int
店铺估值 3 个接口
open.shop_valuation 读 单店估值 + 认证等级
shop_id : int · open.shop_valuation / open.shop_valuation_verify 必填:店铺 ID shop_code : string · 店铺编码(与 shop_id 二选一)
open.shop_valuation_rank 读 店铺估值排行榜
limit : int · 返回条数,默认 20
open.shop_valuation_verify 读 估值认证背书验证
shop_id : int · open.shop_valuation / open.shop_valuation_verify 必填:店铺 ID
应用市场 1 个接口
open.apps 读 应用市场应用列表(公开)
page : int pageSize : int
平台状态 1 个接口
open.status 读 开放 API 服务状态 + 调用统计(公开)
无请求参数(仅需 action 固定值)
开发者·密钥 6 个接口
dev.overview 读 开发者概览(配额/用量/计划)
无请求参数(仅需 action 固定值)
dev.apply 读 开发者入驻申请
无请求参数(仅需 action 固定值)
dev.keys 读 API 密钥列表(脱敏)
无请求参数(仅需 action 固定值)
dev.create_key 写 签发新密钥(写,Secret 仅展示一次)
name : string · 应用名称 / dev.webhook_create 可选:订阅名称 env : string · 环境,默认 live
dev.revoke_key 写 吊销密钥(写)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID
dev.rotate_key 写 轮换密钥(写,旧密钥失效)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID
开发者·用量 1 个接口
dev.usage 读 调用用量统计(按日/端点)
days : int · 统计天数,默认 30
开发者·中心 2 个接口
dev.developer_index 读 开发者中心首页数据
无请求参数(仅需 action 固定值)
dev.developer_leaderboard 读 开发者贡献排行榜
无请求参数(仅需 action 固定值)
开发者·Webhook 8 个接口
dev.webhook_events 读 可订阅事件列表
无请求参数(仅需 action 固定值)
dev.webhooks 读 Webhook 订阅列表
无请求参数(仅需 action 固定值)
dev.webhook_create 写 创建 Webhook 订阅(写)
url : string · dev.webhook_create 必填:回调 URL name : string · dev.create_key 可选:应用名称 / dev.webhook_create 可选:订阅名称 events : string · 订阅事件,逗号分隔,默认 *(全部)
dev.webhook_delete 写 删除 Webhook 订阅(写)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID
dev.webhook_pause 写 暂停 Webhook 订阅(写,熔断也会自动暂停)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID
dev.webhook_resume 写 恢复 Webhook 订阅(写,清零连续失败计数)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID
dev.webhook_test 写 测试投递 Webhook(写)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID
dev.webhook_deliveries 读 Webhook 投递记录(按订阅/状态筛选)
status : string · merchant_orders / merchant_settlements 可选:状态过滤 page : int pageSize : int
开发者·应用市场 3 个接口
dev.apps 读 我的应用市场应用列表
无请求参数(仅需 action 固定值)
dev.app_publish 写 上架/编辑应用(写)
id : int · open.product / dev.revoke_key / dev.rotate_key / dev.webhook_delete / dev.webhook_test 必填:资源 ID name : string · dev.create_key 可选:应用名称 / dev.webhook_create 可选:订阅名称
dev.market 读 应用市场列表(登录态,公开上架应用)
page : int pageSize : int
ERROR CODES
错误码说明
统一响应结构 { "success": bool, "msg": string, "data": ... },非 2xx 时 success 为 false。
状态码含义处理建议
200成功读取 data 字段
400参数错误检查 body 中的 action 与参数
401鉴权失败 / 签名错误 / 时间戳超时核对 Key、Secret 与签名算法,时间戳 ±300 秒内
403无权限(开发者未通过审核 / 未绑定店铺)完成入驻审核并绑定有效店铺
404接口不存在 / 资源不存在核对 action 名称与资源 id
429调用频率超限降低频率或升级套餐提升配额
500服务器异常稍后重试,系统已自动告警