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_deposit

明細入金

ユーザーの入金:明細を確認し、そのユーザーの入金を記録して webhook でサイトに通知します。

🕒 最終更新: タイ時間(UTC+07:00) · ✅ 既存のコードはそのまま動作

🤖 AI に連携コードを書かせる

このリンクを AI に渡すか(API 全体の Markdown)、ボタンを押すとプロンプトがコピーされ AI が開きます

https://api.tungkao.com/docs/api/slip_deposit.md?lang=ja
https://api.tungkao.com/changelog/slip_deposit.json

このリンクはこの API の更新を JSON で返します(key 不要・どのドメインからも可)。管理画面に「更新のお知らせ」として表示し、last_updated が変わったら「新着」を付けてください

ChatGPT ↗Claude ↗Gemini ↗Grok ↗

コピーして開く: AI ボタンでプロンプトが自動コピーされます。入力欄が空なら貼り付けてください

🔑 使うキー

加盟店ポータル(API key)で slip_deposit キーを作成し、すべてのリクエストにこの header を送ります — 他サービスのキーはここでは使えません

Authorization: Bearer $TUNGKAO_KEY

📋 手順

  1. ポータルでキーに受取口座と webhook URL を設定します。
  2. customer_ref(あなたのユーザー ID)付きで明細を送信します。
  3. deposit.succeeded webhook を受けたら(署名を確認して)ユーザーに反映します。

📡 API 呼び出し + コード例

POST/v1/deposits/slip
curl -X POST https://api.tungkao.com/v1/deposits/slip \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"qr_payload":"0041000600000101030040220014…","customer_ref":"member-1001","expected_amount":"300.00"}'
GET/v1/deposits/dep_xxx
curl -X GET https://api.tungkao.com/v1/deposits/dep_xxx \
  -H "Authorization: Bearer $TUNGKAO_KEY"

webhook 署名の検証

すべての webhook に X-Tungkao-Signature: t=…,v1=… が付きます。データを信頼する前に検証してください(URL 設定時に webhook 秘密が表示されます)。

import crypto from "node:crypto";
// use the raw body only — never re-JSON.stringify it
function verify(rawBody, header, secret) {
  const m = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(header || "");
  if (!m || Math.abs(Date.now() / 1000 - Number(m[1])) > 300) return false;
  const want = crypto.createHmac("sha256", secret).update(`${m[1]}.${rawBody}`).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(want), Buffer.from(m[2]));
}

📚 使い方の例

例 1

Credit a member's deposit

状況: Member member-1001 deposits 300 THB and attaches the slip

リクエスト
POST /v1/deposits/slip
{
  "image_base64": "<base64 of the slip image>",
  "customer_ref": "member-1001",
  "expected_amount": "300.00"
}
レスポンス例
{
  "success": true,
  "status": "VALID",
  "data": {
    "deposit_id": "dep_8f2c…",
    "customer_ref": "member-1001",
    "amount": "300.00"
  }
}

➡️ Store deposit_id with the order and credit the member

例 2

Attach your own data to the deposit

状況: You want to know which promotion the deposit came from

リクエスト
POST /v1/deposits/slip
{
  "image_base64": "<base64 of the slip image>",
  "customer_ref": "member-1001",
  "metadata": {
    "promo": "NEWYEAR",
    "channel": "app"
  }
}

➡️ metadata comes back in the webhook and when you fetch the deposit

例 3

Receive the result by webhook

状況: With a webhook URL on the key, the result is pushed to your site

➡️ Verify the webhook signature before crediting and use deposit_id to avoid double credit

例 4

Check a deposit later

状況: Your site missed the webhook or wants to re-check

リクエスト
GET /v1/deposits/dep_8f2c…
レスポンス例
{
  "success": true,
  "data": {
    "deposit_id": "dep_8f2c…",
    "status": "succeeded"
  }
}

➡️ succeeded = credit · failed = rejected · pending = wait

例 5

Member resubmits the same slip

状況: A member tries to deposit again with the same slip

レスポンス例
{
  "success": false,
  "status": "DUPLICATE"
}

➡️ DUPLICATE; no new deposit is created

📜 この API の更新履歴

  1. 追加 タイ時間(UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  2. 追加 タイ時間(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)
  3. 追加 タイ時間(UTC+07:00)
    GET /status:サービス別の API ステータス(キー不要)
  4. 追加 タイ時間(UTC+07:00)
    キーのオン/オフと状態変更時刻 + 1 サイトにつきサービスごとに 1 キー
  5. 改善 タイ時間(UTC+07:00)
    API v1 を恒久固定(追加のみ)+ X-Tungkao-Api-Version header + 12 か月前の廃止予告
  6. ドキュメント タイ時間(UTC+07:00)
    API ごとのドキュメントと AI リンク(10 言語)
  7. セキュリティ タイ時間(UTC+07:00)
    API キーごとのドメイン認証(1 キー = 1 サイト)— 既存キーはそのまま動作
  8. 追加 タイ時間(UTC+07:00)
    任意の HMAC リクエスト署名 — オンにしなければ変化なし
  9. 追加 タイ時間(UTC+07:00)
    API キーの期限・期限前通知・更新 — キー文字列は変わらない
  10. 追加 タイ時間(UTC+07:00)
    全サービスに test モードキー(模擬・無料)
  11. 新規 タイ時間(UTC+07:00)
    明細入金と webhook を開始

✅ 既存のコードはそのまま動作

🛡️ 安定性の約束:一度つなげばずっと動く

🚦 システム状況(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