API 概览
Base URL
KingsPay 为商户提供两个 API 环境:
| 环境 | Base URL |
|---|---|
| Production | https://merchant-api.kingspay.id |
| Sandbox | https://sandbox-merchant-api.kingspay.id/ |
所有 API 端点遵循格式:{baseUrl}/api/v1/{resource}/{action}
鉴权
API 鉴权信息将由 KingsPay 提供给已注册商户。通常请求需要 Authorization(Bearer token 或 API Key)与 Content-Type: application/json 等请求头。
请求与响应格式
- Content-Type:
application/json - Response: 所有响应均为 JSON,结构如下:
status(boolean):请求是否成功message(string):描述信息logId(string):用于跟踪/排障的唯一 IDdata(object, optional):响应数据(仅成功时返回)
HTTP 状态码
| Code | 说明 |
|---|---|
| 200 | 请求处理成功 |
| 400 | Bad Request — 参数校验失败或参数无效 |
| 401 | Unauthorized — 鉴权失败 |
| 404 | Not Found — 资源不存在 |
| 500 | Internal Server Error — 服务器错误 |