TUNGKAO API 문서
🏦
API · slip_deposit

영수증 입금

사용자 충전: 영수증을 확인하고 해당 사용자의 입금을 기록한 뒤 webhook으로 사이트에 알립니다.

🕒 최근 업데이트: 태국 시간 (UTC+07:00) · ✅ 기존 코드 그대로 작동

🤖 AI에게 연동 코드 맡기기

이 링크를 AI에게 주거나(전체 API Markdown) 버튼을 누르세요. 프롬프트가 복사되고 AI가 열립니다

https://app.tungkao.com/docs/api/slip_deposit.md?lang=ko
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개
  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