TUNGKAO API 文档
点击按钮后选择“另存为 PDF”

TUNGKAO API

银行转账凭证核验

API v1 · 最近更新: 泰国时间(UTC+07:00)

https://tungkao.com · https://api.tungkao.com/docs

根据服务条款,使用本服务的页面必须显示指向 https://tungkao.com 的 “Powered by TUNGKAO”(登录/支付可用 “Secured by TUNGKAO”)

🧾
API · slip_verify

银行转账凭证核验

核验凭证是否真实、金额是否一致、是否转入你的账户以及是否已被使用——适合客户上传凭证的店铺。

🕒 最近更新: 泰国时间(UTC+07:00) · ✅ 现有代码照常可用,无需修改

🤖 让 AI 帮你写对接代码

复制此链接给 AI 阅读(该 API 的完整 Markdown),或点击下方按钮:自动复制提示词并打开所选 AI,粘贴后告诉它你的语言/框架

https://api.tungkao.com/docs/api/slip_verify.md?lang=zh-CN
https://api.tungkao.com/changelog/slip_verify.json

此链接以 JSON 返回该 API 的更新(无需 key,任何域名可访问)。可在后台显示为“更新公告”框,last_updated 变化时标记“新”

复制并打开: 点击 AI 按钮会自动复制提示词,若对话框为空直接粘贴即可

🔑 使用的密钥

在商户后台(API key)创建 slip_verify 密钥,并在每个请求中发送此 header——其他服务的密钥在这里无效

Authorization: Bearer $TUNGKAO_KEY

📋 步骤

  1. 客户上传凭证;你的网站读取其二维码文字(以 0041… 开头)。
  2. 把 qr_payload、应收金额和你的收款账户发送给 API。
  3. 只有当 status 为 VALID 时才确认订单。

📡 接口调用 + 代码示例

POST/v1/slip/verify
curl -X POST https://api.tungkao.com/v1/slip/verify \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"qr_payload":"0041000600000101030040220014…","expected_amount":"500.00","receivers":[{"bank":"KBANK","account_number":"1234567890"}]}'

📖 小结:一个 key 用于多个网站会怎样

情况key 设置(API Keys 页面)结果
2 个网站(aaa.com、bbb.com)收款到同一账户两个 key:A 组(或整个账户)在 aaa.com 通过的凭证,到 bbb.com 返回 DUPLICATE — 只能在一个网站使用 ✅
2 个网站同一账户但 key 分开(默认)两个 key:仅此 key一张凭证两个网站都通过 ⚠️ 客户可能充值两次 — 请关联 key
2 个网站收款账户不同仅此 key(默认)一个网站的凭证到另一个网站已返回 RECEIVER_MISMATCH ✅
2 个网站属于不同 tungkao 账户(不同所有者)但收款账户相同不同 tungkao 账户之间的 key 无法关联一张凭证两边都通过 ⚠️ — 请在同一 tungkao 账户购买两个 key 并关联
一个网站使用 2 个 key(例如网站 + 应用)两个 key:同一组无论从网站还是应用提交,凭证都只能使用一次 ✅

DUPLICATE 通过二维码中的参考号即时识别。在 API Keys 页面的“key 之间防重复凭证”卡片中设置(新 key 默认:仅此 key)。

📚 使用示例

示例 1

Customer tops up with a matching slip (passes)

场景: A customer transfers 500 THB to your account and uploads the slip on your top-up page

请求
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00"
}
响应示例
{
  "success": true,
  "status": "VALID",
  "data": {
    "trans_ref": "2025111612345678",
    "amount": "500.00",
    "currency": "THB"
  },
  "billing": {
    "credits_charged": 250
  }
}

➡️ VALID → credit the customer now; the slip is marked as used

示例 2

Send the QR text instead of the image (faster)

场景: Your app reads the QR on the slip itself and sends only the QR text

请求
POST /v1/slip/verify
{
  "qr_payload": "0041000600000101030040220014242082547BPM04988…",
  "expected_amount": "500.00"
}

➡️ Same result as sending the image, smaller and faster. If you have the image, send it: some backup providers verify from the image

示例 3

The customer sends the same slip again

场景: The customer attaches the same 500 THB slip again to top up twice

请求
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00"
}
响应示例
{
  "success": false,
  "status": "DUPLICATE",
  "message": "This slip has already been used"
}

➡️ DUPLICATE → do not credit; tell the customer the slip was already used

示例 4

Wrong amount or wrong account

场景: The customer paid 300 THB for a 500 THB order, or paid another account

请求
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00",
  "receivers": [
    {
      "bank": "KBANK",
      "account_number": "123-4-56789-0"
    }
  ]
}
响应示例
{
  "success": false,
  "status": "AMOUNT_MISMATCH"
}

➡️ AMOUNT_MISMATCH = wrong amount · RECEIVER_MISMATCH = other account. The slip is not marked as used, so the customer can retry with the right one

示例 5

Slip is too old

场景: You only accept slips paid within the last 30 minutes

请求
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00",
  "max_age_minutes": 30
}
响应示例
{
  "success": false,
  "status": "DATE_MISMATCH"
}

➡️ DATE_MISMATCH when the slip is older than allowed

示例 6

Two sites, one receiving account

场景: aaa.com and bbb.com use different keys but receive into the same account

➡️ Put both keys in one group on the “Duplicate-slip protection between keys” card → a slip that passed on aaa.com returns DUPLICATE on bbb.com

示例 7

Every verifier is down

场景: All upstream verifiers fail at once (rare; backups are tried first)

响应示例
{
  "success": false,
  "status": "SERVICE_UNAVAILABLE"
}

➡️ HTTP 503 and nothing is charged. Ask the customer to retry later, or queue it for manual review

💡 更多

📜 此 API 的更新记录

  1. 新增 泰国时间(UTC+07:00)
    Duplicate-slip protection between keys is now configurable: this key only / group A–E / whole account — for several sites that receive into the same account
  2. 新增 泰国时间(UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  3. 新增 泰国时间(UTC+07:00)
    error.user_message: ready-to-show text for end users on outages, no credits or key problems (white-label keys omit tungkao.com)
  4. 新增 泰国时间(UTC+07:00)
    GET /status:按服务显示 API 状态(无需密钥)
  5. 新增 泰国时间(UTC+07:00)
    密钥开关及状态变更时间 + 每个网站每项服务 1 个密钥
  6. 改进 泰国时间(UTC+07:00)
    API v1 永久冻结(仅新增)+ X-Tungkao-Api-Version header + 提前 12 个月的弃用通知
  7. 文档 泰国时间(UTC+07:00)
    每个 API 独立文档页及 AI 链接(10 种语言)
  8. 安全 泰国时间(UTC+07:00)
    每个 API 密钥域名验证(1 密钥 = 1 网站)——现有密钥照常可用
  9. 新增 泰国时间(UTC+07:00)
    可选 HMAC 请求签名——不开启则一切照旧
  10. 新增 泰国时间(UTC+07:00)
    API 密钥有效期、到期提醒和续期——密钥字符串不变
  11. 新增 泰国时间(UTC+07:00)
    所有服务支持 test 模式密钥(模拟、免费)
  12. 上线 泰国时间(UTC+07:00)
    上线 API v1 凭证核验(3 家服务商自动切换)

✅ 现有代码照常可用,无需修改

🛡️ 稳定性承诺:一次对接,长期可用

🚦 系统状态(GET /status)

随时查看 API 是否正常,无需密钥

GET https://api.tungkao.com/status

curl https://api.tungkao.com/status
{
  "success": true,
  "data": {
    "status": "ok",
    "services": [
      { "id": "slip_verify", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "slip_deposit", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "login", "status": "ok" },
      { "id": "telegram", "status": "ok" },
      { "id": "discord", "status": "ok" },
      { "id": "email", "status": "busy" },
      { "id": "crypto", "status": "ok" },
      { "id": "core", "status": "ok" }
    ],
    "paused": [],
    "updated_at": "2026-11-14T12:00:00.000Z"
  }
}

🏷️ TUNGKAO 署名要求

Powered by TUNGKAO