TUNGKAO Tài liệu API

Tích hợp với TUNGKAO

Một kiểu API cho mọi dịch vụ — Base URL: https://api.tungkao.com

🕒 Cập nhật API mới nhất theo kênh

Toàn hệ thống cập nhật lần cuối: Giờ Thái Lan (UTC+07:00) — 📘 The TrueMoney Wallet docs page is now fully translated into all 10 languages (steps, examples, case table, notes)

✅ Mã cũ vẫn chạy, không cần sửa · /changelog.json (Dạng máy đọc)

Paste it into the AI that maintains your site's code (ChatGPT / Claude / Gemini); it checks and changes only what is needed
🧾Kiểm tra biên lai ngân hàng Giờ Thái Lan (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 accountXác minh biên lai TrueMoney Wallet Giờ Thái Lan (UTC+07:00)📘 The TrueMoney Wallet docs page is now fully translated into all 10 languages (steps, examples, case table, notes)🏦Nạp tiền bằng biên lai Giờ Thái Lan (UTC+07:00)Ra mắt nạp tiền bằng biên lai kèm webhook₿Thanh toán crypto Giờ Thái Lan (UTC+07:00)Thêm mạng Ethereum, Polygon, Arbitrum, Base, Optimism, Avalanche và USDCThông báo Telegram Giờ Thái Lan (UTC+07:00)Telegram / Discord notifications: step-by-step setup guide on the key card and in the docs (Telegram connect link, add a Discord channel webhook)Thông báo Discord Giờ Thái Lan (UTC+07:00)Telegram / Discord notifications: step-by-step setup guide on the key card and in the docs (Telegram connect link, add a Discord channel webhook)📧Gửi email + OTP + SMTP Giờ Thái Lan (UTC+07:00)Ra mắt dịch vụ email: API + SMTP + OTP qua emailĐăng nhập bằng Google Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng LINE Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Facebook Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng TikTok Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Discord Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Telegram Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng X (Twitter) Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Microsoft Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng GitHub Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng Apple Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng Steam Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng Twitch Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng LinkedIn Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Kakao Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng NAVER Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Zalo Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Spotify Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Reddit Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng GitLab Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng Roblox Giờ Thái Lan (UTC+07:00)🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.Đăng nhập bằng Epic Games Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng Yahoo Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng Slack Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their groupĐăng nhập bằng Amazon Giờ Thái Lan (UTC+07:00)Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their group
🚀

Bắt đầu

Mọi dịch vụ dùng như nhau: tạo API key trong cổng bán hàng (mỗi dịch vụ một key) và gửi trong header Authorization của mọi yêu cầu.

Cách hoạt động

  1. Đăng nhập app.tungkao.com bằng Gmail và nạp tín dụng (1 baht = 100 tín dụng).
  2. API key → chọn thẻ dịch vụ → chọn thời hạn key → Tạo → sao chép key (chỉ hiện một lần).
  3. Giữ key trên máy chủ (biến môi trường TUNGKAO_KEY). Không bao giờ đặt trong trang web hoặc app di động.
  4. Bắt đầu với key test (tk_test_…) — không trừ tín dụng — rồi chuyển sang live.
GET/v1/account — Thử key: tín dụng còn lại
curl -X GET https://api.tungkao.com/v1/account \
  -H "Authorization: Bearer $TUNGKAO_KEY"

Ký yêu cầu (khi bật)

import crypto from "node:crypto";
async function tungkao(method, path, body) {
  const raw = body ? JSON.stringify(body) : "";
  const ts = Math.floor(Date.now() / 1000).toString();
  const hash = crypto.createHash("sha256").update(raw).digest("hex");
  const sig = crypto.createHmac("sha256", process.env.TUNGKAO_SIGNING_SECRET).update(`${ts}.${method}.${path}.${hash}`).digest("hex");
  const r = await fetch("https://api.tungkao.com" + path, { method, body: raw || undefined, headers: {
    Authorization: `Bearer ${process.env.TUNGKAO_KEY}`, "Content-Type": "application/json",
    "X-Tungkao-Timestamp": ts, "X-Tungkao-Signature": sig } });
  return r.json();
}
console.log(await tungkao("GET", "/v1/account"));
  • Mọi phản hồi là JSON có success và request_id. Lỗi có error.code (vd KEY_EXPIRED, INSUFFICIENT_CREDITS) — xem /errors.
  • error.user_message is the text to show your own end users (“The system cannot connect to the tungkao.com API. Please contact the administrator.”). It comes with errors an end user cannot fix: HTTP 5xx, SERVICE_PAUSED, INSUFFICIENT_CREDITS and key problems, in the Accept-Language language. Keys with white-label enabled get a message without the tungkao.com name. If the API cannot be reached at all (timeout/network down), show the same text from your own code.
  • Key hết hạn theo lựa chọn (1–24 tháng hoặc không hết hạn). Nhắc trước 30/7/1 ngày qua webhook api_key.expiring. Gia hạn trong cổng — chuỗi key giữ nguyên.
  • Xác minh tên miền: mỗi key live gắn với một website. API key → 'Xác minh tên miền' → nhập tên miền, tải tungkao-verify-….html lên https://ten-mien/ (hoặc thêm DNS TXT _tungkao-verify.ten-mien) rồi bấm Xác minh. Key chưa xác minh nhận DOMAIN_NOT_VERIFIED; tên miền đã xác minh không đổi được và tài khoản khác không dùng được.
  • Lộ khóa bí mật? Bấm 'Đổi key ngay' — không giới hạn, key cũ ngừng ngay. Key chỉ dùng cho dịch vụ của nó (nếu không sẽ là WRONG_PRODUCT).
  • Nâng cao (tùy chọn): bật 'Ký yêu cầu' trên key để nhận tksign_…; sau đó mọi yêu cầu cần X-Tungkao-Timestamp và X-Tungkao-Signature = HMAC-SHA256(bí mật, ts.METHOD.path.sha256(body)). Chỉ lộ key thì vô dụng.
  • 🧪 Test mode (tk_test_… keys) is free and limited to 2 calls per service per day (non-GET requests only; resets at midnight Bangkok time). Beyond that you get HTTP 429 RATE_LIMITED with a message — use a live key for unlimited calls.
  • Gửi Accept-Language (th, en, lo, my, zh-CN, ko, ja, vi, km, id) để chọn ngôn ngữ thông báo.
🧾

Kiểm tra biên lai ngân hàng

slip_verify

Kiểm tra biên lai là thật, đúng số tiền, chuyển cho bạn và chưa được dùng — cho cửa hàng có khách đính kèm biên lai.

Cách hoạt động

  1. Khách tải biên lai lên; site đọc văn bản QR (bắt đầu bằng 0041…).
  2. Gửi qr_payload, số tiền mong đợi và tài khoản nhận tới API.
  3. Chỉ chấp nhận đơn khi status là 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"}]}'

📖 Tóm tắt: dùng key cho nhiều trang web

Trường hợpCài đặt key (trang API Keys)Kết quả
2 trang (aaa.com, bbb.com) nhận tiền vào cùng một tài khoảnCả hai key: Nhóm A (hoặc Toàn tài khoản)Biên lai đã qua ở aaa.com sẽ trả DUPLICATE ở bbb.com — chỉ dùng được trên một trang ✅
2 trang chung tài khoản nhưng key tách riêng (mặc định)Cả hai key: Chỉ key nàyMột biên lai qua được cả hai trang ⚠️ khách có thể nạp hai lần — hãy liên kết key
2 trang có tài khoản nhận khác nhauChỉ key này (mặc định)Biên lai của trang này sang trang kia đã trả RECEIVER_MISMATCH ✅
2 trang thuộc 2 tài khoản tungkao khác nhau (chủ khác) nhưng cùng tài khoản nhậnKhông thể liên kết key giữa các tài khoản tungkaoMột biên lai qua cả hai ⚠️ — hãy mua cả hai key từ một tài khoản tungkao và liên kết
Một trang dùng 2 key (vd. web + ứng dụng)Cả hai key: cùng nhómBiên lai chỉ dùng được một lần dù gửi từ web hay ứng dụng ✅

DUPLICATE được phát hiện ngay từ mã tham chiếu trong QR. Cài ở thẻ “Chống dùng lại biên lai giữa các key” trên trang API Keys (key mới mặc định: chỉ key này).

📚 Ví dụ sử dụng

Ví dụ 1

Customer tops up with a matching slip (passes)

Tình huống: A customer transfers 500 THB to your account and uploads the slip on your top-up page

Yêu cầu
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00"
}
Phản hồi mẫu
{
  "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

Ví dụ 2

Send the QR text instead of the image (faster)

Tình huống: Your app reads the QR on the slip itself and sends only the QR text

Yêu cầu
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

Ví dụ 3

The customer sends the same slip again

Tình huống: The customer attaches the same 500 THB slip again to top up twice

Yêu cầu
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00"
}
Phản hồi mẫu
{
  "success": false,
  "status": "DUPLICATE",
  "message": "This slip has already been used"
}

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

Ví dụ 4

Wrong amount or wrong account

Tình huống: The customer paid 300 THB for a 500 THB order, or paid another account

Yêu cầu
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00",
  "receivers": [
    {
      "bank": "KBANK",
      "account_number": "123-4-56789-0"
    }
  ]
}
Phản hồi mẫu
{
  "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

Ví dụ 5

Slip is too old

Tình huống: You only accept slips paid within the last 30 minutes

Yêu cầu
POST /v1/slip/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "500.00",
  "max_age_minutes": 30
}
Phản hồi mẫu
{
  "success": false,
  "status": "DATE_MISMATCH"
}

➡️ DATE_MISMATCH when the slip is older than allowed

Ví dụ 6

Two sites, one receiving account

Tình huống: 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

Ví dụ 7

Every verifier is down

Tình huống: All upstream verifiers fail at once (rare; backups are tried first)

Phản hồi mẫu
{
  "success": false,
  "status": "SERVICE_UNAVAILABLE"
}

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

  • Gửi header Idempotency-Key (vd mã đơn): thử lại không bao giờ bị tính phí hai lần.
  • Mỗi biên lai chỉ VALID một lần cho mỗi key (lần thứ hai trả DUPLICATE).
  • Several sites receiving into the same account? Put their keys in the same group under “Duplicate-slip protection between keys” on the API Keys page. A slip that passed on one key then returns DUPLICATE on every key in the group (default: this key only).

Xác minh biên lai TrueMoney Wallet

truewallet_verify

Kiểm tra biên lai chuyển tiền TrueMoney Wallet là thật, đúng số tiền, chuyển vào số ví của bạn và chưa từng được dùng.

Cách hoạt động

  1. Lưu ví nhận tiền một lần (PUT /v1/truewallet/profile, hoặc trên thẻ key ở cổng): số điện thoại ví hoặc e-Wallet ID, tên tiếng Thái/tiếng Anh và ảnh QR nhận tiền.
  2. Hiển thị ảnh QR (qr_image_url) để khách thanh toán, rồi cho khách tải ảnh biên lai lên.
  3. Gửi ảnh biên lai (image_base64) và số tiền dự kiến tới API. Số và tên lấy từ hồ sơ đã lưu (hoặc gửi wallet_number / ewallet_id trong yêu cầu).
  4. Chỉ chấp nhận đơn khi status là VALID.
PUT/v1/truewallet/profile
curl -X PUT https://api.tungkao.com/v1/truewallet/profile \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"wallet_number":"0812345678","ewallet_id":"140000812345678","name_en":"Somchai Jaidee","qr_image_base64":"<base64 QR image>"}'
GET/v1/truewallet/profile
curl -X GET https://api.tungkao.com/v1/truewallet/profile \
  -H "Authorization: Bearer $TUNGKAO_KEY"
POST/v1/truewallet/verify
curl -X POST https://api.tungkao.com/v1/truewallet/verify \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_base64":"<base64 slip image>","expected_amount":"500.00"}'

📖 Tóm tắt: dùng key cho nhiều trang web

Trường hợpCài đặt key (trang API Keys)Kết quả
2 trang (aaa.com, bbb.com) nhận tiền vào cùng một tài khoảnCả hai key: Nhóm A (hoặc Toàn tài khoản)Biên lai đã qua ở aaa.com sẽ trả DUPLICATE ở bbb.com — chỉ dùng được trên một trang ✅
2 trang chung tài khoản nhưng key tách riêng (mặc định)Cả hai key: Chỉ key nàyMột biên lai qua được cả hai trang ⚠️ khách có thể nạp hai lần — hãy liên kết key
2 trang có tài khoản nhận khác nhauChỉ key này (mặc định)Biên lai của trang này sang trang kia đã trả RECEIVER_MISMATCH ✅
2 trang thuộc 2 tài khoản tungkao khác nhau (chủ khác) nhưng cùng tài khoản nhậnKhông thể liên kết key giữa các tài khoản tungkaoMột biên lai qua cả hai ⚠️ — hãy mua cả hai key từ một tài khoản tungkao và liên kết
Một trang dùng 2 key (vd. web + ứng dụng)Cả hai key: cùng nhómBiên lai chỉ dùng được một lần dù gửi từ web hay ứng dụng ✅

DUPLICATE được phát hiện ngay từ mã tham chiếu trong QR. Cài ở thẻ “Chống dùng lại biên lai giữa các key” trên trang API Keys (key mới mặc định: chỉ key này).

📚 Ví dụ sử dụng

Ví dụ 1

Lưu ví nhận tiền một lần

Tình huống: Cửa hàng nhận tiền vào TrueMoney 081-234-5678 (Somchai) và có QR nhận tiền

Yêu cầu
PUT /v1/truewallet/profile
{
  "receive_by": "wallet_number",
  "wallet_number": "0812345678",
  "name_en": "Somchai Jaidee",
  "qr_image_base64": "<base64 of the QR image>"
}
Phản hồi mẫu
{
  "success": true,
  "data": {
    "receive_by": "wallet_number",
    "wallet_number": "0812345678",
    "qr_image_url": "https://api.tungkao.com/v1/truewallet/qr/…"
  }
}

➡️ Hiển thị qr_image_url trên trang thanh toán để khách quét

Ví dụ 2

Xác minh bằng ví đã lưu

Tình huống: Khách chuyển 300 baht vào ví TrueMoney của bạn và đính kèm biên lai

Yêu cầu
POST /v1/truewallet/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "300.00"
}
Phản hồi mẫu
{
  "success": true,
  "status": "VALID",
  "data": {
    "amount": "300.00",
    "currency": "THB"
  }
}

➡️ Không cần gửi lại số; dùng ví đã lưu trong key

Ví dụ 3

Chỉ nhận bằng e-Wallet ID

Tình huống: Khách thanh toán qua e-Wallet ID 15 số; bạn không phải công khai số điện thoại

Yêu cầu
PUT /v1/truewallet/profile
{
  "receive_by": "ewallet_id",
  "ewallet_id": "140000812345678"
}

➡️ Biên lai chuyển vào số điện thoại trả RECEIVER_MISMATCH; chỉ chấp nhận e-Wallet ID

Ví dụ 4

Gửi người nhận trong yêu cầu (nhiều ví)

Tình huống: Bạn xoay vòng nhiều ví theo chi nhánh

Yêu cầu
POST /v1/truewallet/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "300.00",
  "wallet_numbers": [
    "0812345678",
    "0898765432"
  ],
  "wallet_name_en": "Somchai Jaidee"
}

➡️ Qua nếu biên lai chuyển vào một ví trong danh sách và tên khớp

Ví dụ 5

Nhà cung cấp chính lỗi, dự phòng tiếp quản

Tình huống: Dịch vụ xác minh chính lỗi khi khách đang gửi

Yêu cầu
POST /v1/truewallet/verify
{
  "image_base64": "<base64 of the slip image>",
  "expected_amount": "300.00"
}

➡️ Dự phòng xác minh ngay trong cùng yêu cầu. Gửi image_base64: dự phòng xác minh từ ảnh

Ví dụ 6

Trùng hoặc sai số tiền

Tình huống: Khách gửi lại biên lai hoặc chuyển thiếu

Phản hồi mẫu
{
  "success": false,
  "status": "DUPLICATE"
}

➡️ DUPLICATE = đã dùng · AMOUNT_MISMATCH = sai số tiền. Không cộng tín dụng trong cả hai trường hợp

  • Xác định người nhận bằng một trong hai hoặc cả hai: wallet_number (số điện thoại 10 số) hoặc ewallet_id (e-Wallet ID 15 số). Biên lai khớp một trong hai là qua.
  • Chọn cách nhận bằng receive_by: wallet_number (chỉ số), ewallet_id (chỉ e-Wallet ID) hoặc any (mặc định, một trong hai). Biên lai được kiểm tra theo định danh đã chọn.
  • Tên người nhận: name_th, name_en hoặc cả hai (wallet_name_th / wallet_name_en trong yêu cầu xác minh). Nếu đặt, biên lai phải khớp một tên; nếu không đặt, không kiểm tra tên.
  • Ảnh QR nhận tiền: JPG/PNG tối đa 1 MB, đọc được QR. Bạn nhận qr_image_url cho trang thanh toán; tải ảnh mới sẽ tạo liên kết mới.
  • wallet_number là số điện thoại 10 số của ví nhận. Gửi nhiều số bằng wallet_numbers (tối đa 10) hoặc lưu trên key ở cổng.
  • Phản hồi và trạng thái giống /v1/slip/verify. Mỗi biên lai chỉ VALID một lần cho mỗi key (lần thứ hai trả DUPLICATE).
  • Gửi header Idempotency-Key (vd mã đơn): thử lại không bao giờ bị tính phí hai lần.
🏦

Nạp tiền bằng biên lai

slip_deposit

Nạp tiền cho người dùng: kiểm tra biên lai, ghi nhận khoản nạp của người đó và báo site qua webhook.

Cách hoạt động

  1. Đặt tài khoản nhận và URL webhook cho key trong cổng.
  2. Gửi biên lai kèm customer_ref (ID người dùng của bạn).
  3. Khi nhận webhook deposit.succeeded (kiểm tra chữ ký) hãy cộng tiền cho người dùng.
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"

Kiểm tra chữ ký webhook

Mỗi webhook có X-Tungkao-Signature: t=…,v1=…. Kiểm tra trước khi tin dữ liệu (bí mật webhook hiện khi bạn đặt URL).

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]));
}

📚 Ví dụ sử dụng

Ví dụ 1

Credit a member's deposit

Tình huống: Member member-1001 deposits 300 THB and attaches the slip

Yêu cầu
POST /v1/deposits/slip
{
  "image_base64": "<base64 of the slip image>",
  "customer_ref": "member-1001",
  "expected_amount": "300.00"
}
Phản hồi mẫu
{
  "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

Ví dụ 2

Attach your own data to the deposit

Tình huống: You want to know which promotion the deposit came from

Yêu cầu
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

Ví dụ 3

Receive the result by webhook

Tình huống: 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

Ví dụ 4

Check a deposit later

Tình huống: Your site missed the webhook or wants to re-check

Yêu cầu
GET /v1/deposits/dep_8f2c…
Phản hồi mẫu
{
  "success": true,
  "data": {
    "deposit_id": "dep_8f2c…",
    "status": "succeeded"
  }
}

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

Ví dụ 5

Member resubmits the same slip

Tình huống: A member tries to deposit again with the same slip

Phản hồi mẫu
{
  "success": false,
  "status": "DUPLICATE"
}

➡️ DUPLICATE; no new deposit is created

🔐

Sign-in for your website (Google, LINE, Facebook, Apple, TikTok, Discord, Telegram, X, Microsoft, GitHub + 14 more)

Add 'Sign in with …' to your site without registering with each provider. Get name, email, photo, a stable member id, and a member list with sign-in history. One service per provider: google_login, line_login, facebook_login, tiktok_login, discord_login, telegram_login, x_login, microsoft_login, github_login.

Cách hoạt động

  1. Tạo key cho nhà cung cấp, rồi ở 'Thành viên đăng nhập' đặt tên site và redirect URI (https, khớp chính xác).
  2. Nút đăng nhập đưa người dùng tới /oauth/authorize kèm client_id (ID key), redirect_uri và state (ngẫu nhiên mới, lưu trong session).
  3. Người dùng quay về redirect_uri?code=…&state=… → kiểm tra state → máy chủ gọi POST /v1/login/token trong vòng 2 phút.
  4. Dùng data.user (vd 7F3K9QX2-yourshopcom) làm ID thành viên — cùng một người luôn cùng một ID.
POST/v1/login/token
curl -X POST https://api.tungkao.com/v1/login/token \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code":"from the redirect","redirect_uri":"https://yourshop.com/auth/callback"}'
GET/v1/login/users?limit=50
curl -X GET https://api.tungkao.com/v1/login/users?limit=50 \
  -H "Authorization: Bearer $TUNGKAO_KEY"

📖 Summary: using sign-in keys on several sites

Trường hợpCài đặt key (trang API Keys)Kết quả
One site, 2 keys of the same provider (e.g. website + app, both Google)Both keys: Combined (default)The same person gets the same user ID in both ✅
One site, 2 keys of the same provider, counted as separate accountsBoth keys: SeparateThe same person gets a different user ID on each key
2 sister sites sharing membersBoth keys: Group AA member has the same user ID on both sites ✅
2 unrelated sites that must not link membersBoth keys: SeparateDifferent user IDs, so the sites can't link their members ✅
A Google key and a LINE key (different providers)Any settingAlways different user IDs — they are different provider accounts
A key that already has sign-ins needs a different groupNot allowed (locked 🔒)Create a new key in the wanted group, so member IDs on your site never change

Set it on the “Sign-in user IDs between keys” card on the API Keys page before go-live (new keys default: Combined). Several keys may use the same domain.

Ví dụ đầy đủ (nút + callback + đổi code)

// npm i express express-session
import express from "express";
import session from "express-session";
import crypto from "node:crypto";

const KEY = process.env.TUNGKAO_KEY;            // API key (tk_live_…) server-side only
const CLIENT_ID = process.env.TUNGKAO_CLIENT_ID; // the key id (shown in the portal), not a secret
const REDIRECT = "https://yourshop.com/auth/callback"; // must match the registered URL exactly

const app = express();
app.use(session({ secret: process.env.SESSION_SECRET, resave: false, saveUninitialized: false, cookie: { secure: true, sameSite: "lax" } }));

// 1) your "Sign in" button links here
app.get("/auth/login", (req, res) => {
  req.session.state = crypto.randomBytes(24).toString("base64url");
  const u = new URL("https://api.tungkao.com/oauth/authorize");
  u.search = new URLSearchParams({ client_id: CLIENT_ID, redirect_uri: REDIRECT, state: req.session.state });
  res.redirect(u);
});

// 2) the user comes back with a code
app.get("/auth/callback", async (req, res) => {
  if (!req.query.state || req.query.state !== req.session.state) return res.status(400).send("state mismatch");
  delete req.session.state;
  if (req.query.error) return res.redirect("/login?cancelled=1");
  // 3) exchange the code for the user (within 2 minutes)
  const r = await fetch("https://api.tungkao.com/v1/login/token", {
    method: "POST",
    headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify({ code: req.query.code, redirect_uri: REDIRECT }),
  });
  const j = await r.json();
  if (!j.success) return res.status(400).send(j.error.message);
  req.session.user = j.data; // j.data.user = permanent member id, e.g. 7F3K9QX2-yourshopcom
  res.redirect("/");
});
app.listen(3000);
Nhà cung cấpDịch vụBạn nhận được
Googlegoogle_logintên, email đã xác minh, ảnh
LINEline_logintên, ảnh, email nếu người dùng đồng ý
Facebookfacebook_logintên, ảnh, email
TikToktiktok_logintên hiển thị, ảnh đại diện (không email)
Discorddiscord_logintên, ảnh đại diện, email
Telegramtelegram_loginname, username, photo
X (Twitter)x_loginname, username, photo
Microsoftmicrosoft_loginname, email (Hotmail/Outlook)
GitHubgithub_loginname, email, avatar
Appleapple_loginpermanent member ID (no name or email in this mode)
Steamsteam_loginname, avatar and SteamID (no email)
Twitchtwitch_loginname, email, avatar
LinkedInlinkedin_loginname, email, photo
Kakaokakao_loginname, photo (email once Kakao approves it)
NAVERnaver_loginname, email, photo
Zalozalo_loginname, photo (no email)
Spotifyspotify_loginname, email, photo
Redditreddit_loginusername, avatar (no email)
GitLabgitlab_loginname, email, avatar
Robloxroblox_loginname, avatar (no email)
Epic Gamesepicgames_logindisplay name (no email)
Yahooyahoo_loginname, email, photo
Slackslack_loginname, email, photo
Amazonamazon_loginname, email

📚 Ví dụ sử dụng

Ví dụ 1

A “Sign in with Google” button on your site

Tình huống: A visitor taps Sign in with Google on your site

Yêu cầu
GET /oauth/authorize?client_id=<CLIENT_ID>&redirect_uri=https://yourshop.com/auth/callback&state=xyz

➡️ The user signs in with Google and returns to redirect_uri with a code and the same state

Ví dụ 2

Exchange the code for the user (server side)

Tình huống: Your server receives the code on the callback page (exchange within 2 minutes)

Yêu cầu
POST /v1/login/token
{
  "code": "<code from the callback>",
  "redirect_uri": "https://yourshop.com/auth/callback"
}
Phản hồi mẫu
{
  "success": true,
  "data": {
    "user": "7F3K9QX2-yourshopcom",
    "provider": "google",
    "name": "Somchai",
    "is_new_user": true
  }
}

➡️ Use user as the member id in your database (stable per person)

Ví dụ 3

A returning user signs in

Tình huống: The same person signs in with Google again

Phản hồi mẫu
{
  "success": true,
  "data": {
    "user": "7F3K9QX2-yourshopcom",
    "is_new_user": false,
    "login_count": 5
  }
}

➡️ Same user every time → look up the member and sign them in

Ví dụ 4

One site, two Google keys (website + app)

Tình huống: Separate keys for website and app, same members

➡️ Keep both keys “Combined” (default) before go-live → same user for the same person. Choose “Separate” to keep them apart

Ví dụ 5

List members who signed in

Tình huống: You want to browse or search members of this key

Yêu cầu
GET /v1/login/users?q=somchai&limit=50

➡️ Returns members with last sign-in time and count

Ví dụ 6

The user cancels during sign-in

Tình huống: The user cancels on the Google screen

➡️ Returns to redirect_uri with error instead of code; show a retry button

  • User IDs between keys: new keys default to “Combined (whole account)”, so the same person signing in through keys of the same provider in one account gets the same ID. Change it to group A–E or “Separate” on the API Keys page before the first sign-in; after that the group is locked so member IDs never change.
  • Tính phí mỗi lần đăng nhập thành công và một lần cho mỗi thành viên mới — xem giá hiện tại trên thẻ dịch vụ.
  • Key chế độ test cho phép redirect http://localhost và miễn phí.
  • Không bao giờ đặt API key trong link hay trang — /oauth/authorize chỉ cần client_id (ID key) công khai.
✈️

Thông báo Telegram

telegram_notify

Nhắn tin Telegram cho người dùng qua bot của TUNGKAO — không cần bot riêng. Vd tiền về, trạng thái đơn, OTP.

Cách hoạt động

  1. ref is your own name for a recipient (use your member id, e.g. member-1001): A-Z a-z 0-9 _ . : @ - up to 128 chars. Every call refers to the recipient by this ref.
  2. Add a recipient: your server calls POST /v1/telegram/link {ref} → gets data.url (a t.me/…?start=… link) → show it as a “Connect Telegram” button on the member's profile page (valid 30 minutes, single use; request again any time).
  3. The member opens the link → presses Start in Telegram → the bot confirms (Telegram does not let a bot message someone who never pressed Start, so this step cannot be skipped).
  4. Check the connection: GET /v1/telegram/recipients (status = active) — use it to switch your button to “Connected ✓”.
  5. Send: POST /v1/telegram/send with one ref or up to 100 refs; bold text (parse_mode: HTML) and a link button are supported. Per-recipient results are in data.results: sent / not_linked / failed.
  6. Remove a recipient: DELETE /v1/telegram/recipients/{ref}. Members can also send /stop to the bot. If a member blocks the bot, that recipient is paused until they connect again.
  7. Try it without code: TUNGKAO API key page → this key's card → “Set up notifications” has a create-link button (with QR) and a send-test button.
POST/v1/telegram/link
curl -X POST https://api.tungkao.com/v1/telegram/link \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"member-1001"}'
POST/v1/telegram/send
curl -X POST https://api.tungkao.com/v1/telegram/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"member-1001","text":"<b>Payment received</b> 500 THB","parse_mode":"HTML","button":{"text":"View order","url":"https://yourshop.com/orders/1"}}'
GET/v1/telegram/messages
curl -X GET https://api.tungkao.com/v1/telegram/messages \
  -H "Authorization: Bearer $TUNGKAO_KEY"

📚 Ví dụ sử dụng

Ví dụ 1

Let a member connect Telegram

Tình huống: Member member-1001 wants notifications on Telegram

Yêu cầu
POST /v1/telegram/link
{
  "ref": "member-1001"
}
Phản hồi mẫu
{
  "success": true,
  "data": {
    "url": "https://t.me/…?start=…"
  }
}

➡️ Give the member the link to tap (valid 30 minutes, once)

Ví dụ 2

Notify a payment

Tình huống: 500 THB arrived and you want to notify the member

Yêu cầu
POST /v1/telegram/send
{
  "ref": "member-1001",
  "text": "<b>Payment received</b> 500 THB",
  "parse_mode": "HTML"
}

➡️ The member gets the message in Telegram right away

Ví dụ 3

Message with a link button

Tình huống: You want a button to open the order

Yêu cầu
POST /v1/telegram/send
{
  "ref": "member-1001",
  "text": "Order #1001 shipped",
  "button": {
    "text": "View order",
    "url": "https://yourshop.com/orders/1001"
  }
}

➡️ A button under the message opens the link

Ví dụ 4

Notify several members at once

Tình huống: Announce a promotion to three members

Yêu cầu
POST /v1/telegram/send
{
  "refs": [
    "member-1001",
    "member-1002",
    "member-1003"
  ],
  "text": "New promotion today"
}

➡️ Sent to each member; check results with GET /v1/telegram/messages

Ví dụ 5

A member stops notifications

Tình huống: The member asks to disconnect

Yêu cầu
DELETE /v1/telegram/recipients/member-1001

➡️ The link is removed; no more messages are sent

  • Chỉ tính phí tin đã gửi tới — lỗi (vd người dùng chặn bot) được hoàn và người nhận đó bị tạm dừng.
🔔

Thông báo Discord

discord_notify

Gửi tin vào kênh Discord của bạn hoặc khách — vd báo đơn mới cho đội.

Cách hoạt động

  1. Create a channel webhook in Discord (needs Manage Webhooks): desktop right-click the channel → Edit Channel → Integrations → Webhooks → New Webhook → name it → Copy Webhook URL (mobile: long-press the channel → Edit Channel).
  2. ref is your own name for the channel, e.g. orders-room (A-Z a-z 0-9 _ . : @ - up to 128 chars). One key can hold many channels, each with its own ref.
  3. Add a channel: POST /v1/discord/webhooks {ref, url} — url must start with https://discord.com/api/webhooks/…; it is stored encrypted and never returned. Posting the same ref again replaces that channel's link.
  4. Send: POST /v1/discord/send {ref, text} (up to 2000 chars; @everyone / @here are disabled automatically). Results are in data.results: sent / not_linked / failed.
  5. List channels: GET /v1/discord/recipients. Remove: DELETE /v1/discord/recipients/{ref}. If the webhook is deleted in Discord, the channel is paused and the undelivered message is refunded.
  6. Try it without code: TUNGKAO API key page → this key's card → “Set up notifications”: paste the webhook link, add the channel and send a test.
  7. Do not confuse this with the key's “Webhook URL” setting: that is your server address for receiving events from TUNGKAO, not a Discord channel link.
POST/v1/discord/webhooks
curl -X POST https://api.tungkao.com/v1/discord/webhooks \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"orders-room","url":"https://discord.com/api/webhooks/123/abc…"}'
POST/v1/discord/send
curl -X POST https://api.tungkao.com/v1/discord/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ref":"orders-room","text":"🛒 New order #1001 — 590 THB"}'

📚 Ví dụ sử dụng

Ví dụ 1

Register a Discord channel

Tình huống: You want new orders posted in #orders

Yêu cầu
POST /v1/discord/webhooks
{
  "ref": "orders-room",
  "url": "https://discord.com/api/webhooks/123/abc…"
}

➡️ Name it once with ref and use it forever

Ví dụ 2

Post a new order

Tình huống: Order #1001 for 590 THB comes in

Yêu cầu
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "🛒 New order #1001 — 590 THB"
}

➡️ The message appears in the channel right away

Ví dụ 3

Custom sender name

Tình huống: You want the sender to show as “Shop Bot”

Yêu cầu
POST /v1/discord/send
{
  "ref": "orders-room",
  "text": "Daily sales: 12,400 THB",
  "username": "Shop Bot"
}

➡️ The message shows Shop Bot as the sender

Ví dụ 4

Post to several channels

Tình huống: Notify both the admin and the stock channels

Yêu cầu
POST /v1/discord/send
{
  "refs": [
    "admin-room",
    "stock-room"
  ],
  "text": "Stock low: T-shirt size M"
}

➡️ Posted to every listed channel

Ví dụ 5

Check sending history

Tình huống: You want to see which messages failed

Yêu cầu
GET /v1/discord/messages

➡️ Returns each message with its status

📧

Gửi email + OTP + SMTP

email

Gửi email từ website qua API hoặc SMTP (dùng được WordPress), kèm OTP qua email và xác minh — tự chuyển giữa các nhà cung cấp email.

Cách hoạt động

  1. Tạo key email (key thử chỉ gửi tới địa chỉ của bạn, 50 thư/ngày).
  2. SMTP: host smtp.tungkao.com, cổng 587 (STARTTLS) hoặc 465 (SSL), tên đăng nhập bất kỳ, mật khẩu = API key.
  3. API: gửi email, hoặc yêu cầu OTP rồi xác minh bằng otp_id trả về (5 lần thử, dùng một lần).
POST/v1/email/send
curl -X POST https://api.tungkao.com/v1/email/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":["[email protected]"],"subject":"Order #1001 confirmed","html":"<h1>Thanks for your order</h1>","text":"Thanks for your order","from_name":"My Shop","reply_to":"[email protected]"}'
POST/v1/email/otp/send
curl -X POST https://api.tungkao.com/v1/email/otp/send \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"[email protected]","brand":"My Shop","lang":"th","length":6,"ttl_seconds":300}'
POST/v1/email/otp/verify
curl -X POST https://api.tungkao.com/v1/email/otp/verify \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"otp_id":"8f6c2a1e-…","code":"123456"}'

📚 Ví dụ sử dụng

Ví dụ 1

Order confirmation email

Tình huống: A customer completes an order

Yêu cầu
POST /v1/email/send
{
  "to": [
    "[email protected]"
  ],
  "subject": "Order #1001 confirmed",
  "html": "<h1>Thanks for your order</h1>",
  "text": "Thanks for your order",
  "from_name": "My Shop",
  "reply_to": "[email protected]"
}

➡️ Always send html and text; replies go to reply_to

Ví dụ 2

Send an email OTP

Tình huống: A new sign-up must confirm their email

Yêu cầu
POST /v1/email/otp/send
{
  "to": "[email protected]",
  "brand": "My Shop",
  "lang": "th",
  "length": 6,
  "ttl_seconds": 300
}
Phản hồi mẫu
{
  "success": true,
  "data": {
    "otp_id": "8f6c2a1e-…"
  }
}

➡️ Keep otp_id; the code expires in 5 minutes

Ví dụ 3

Check the OTP

Tình huống: The user types the 6-digit code

Yêu cầu
POST /v1/email/otp/verify
{
  "otp_id": "8f6c2a1e-…",
  "code": "123456"
}

➡️ Correct = email confirmed · too many wrong tries = code locked, send a new one

Ví dụ 4

Send to several people

Tình huống: Tell three staff about a large order

Yêu cầu
POST /v1/email/send
{
  "to": [
    "[email protected]",
    "[email protected]",
    "[email protected]"
  ],
  "subject": "Large order #1002",
  "text": "Order #1002: 25,000 THB"
}

➡️ Everyone listed receives the email

Ví dụ 5

Review sent emails

Tình huống: A customer says the email never arrived

Yêu cầu
GET /v1/email/messages

➡️ Check the delivery status of each email

  • Thư được gửi từ địa chỉ của TUNGKAO; tên người gửi (from_name) và reply_to là của bạn.
  • Nếu mọi nhà cung cấp đều lỗi, credit được hoàn tự động · tệp đính kèm qua SMTP không được chuyển tiếp.
₿

Thanh toán crypto (sắp ra mắt)

crypto

Mỗi người dùng có địa chỉ BTC / USDT / USDC riêng (TRON, Ethereum, BNB Chain, Polygon, Arbitrum, Base, Optimism, Avalanche) và báo bạn qua webhook — sắp ra mắt.

Cách hoạt động

  1. Yêu cầu địa chỉ cho người dùng
  2. Người dùng gửi tiền
  3. Cộng tiền khi có crypto.deposit.confirmed
POST/v1/crypto/addresses
curl -X POST https://api.tungkao.com/v1/crypto/addresses \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset":"USDT-TRC20","customer_ref":"member-1001"}'

📚 Ví dụ sử dụng

Ví dụ 1

Get a deposit address for a customer

Tình huống: member-1001 will pay in USDT on TRC20

Yêu cầu
POST /v1/crypto/addresses
{
  "asset": "USDT-TRC20",
  "customer_ref": "member-1001"
}

➡️ You get a per-customer address to show as a QR

Ví dụ 2

List supported coins and networks

Tình huống: You want minimums and confirmations per coin

Yêu cầu
GET /v1/crypto/assets

➡️ Returns min_deposit and confirmations_required per asset

Ví dụ 3

Check incoming deposits

Tình huống: Waiting for the customer's payment

Yêu cầu
GET /v1/crypto/deposits
Phản hồi mẫu
{
  "success": true,
  "data": [
    {
      "asset": "USDT-TRC20",
      "customer_ref": "member-1001",
      "amount": "25.00",
      "confirmations": 20,
      "confirmations_required": 20,
      "status": "confirmed"
    }
  ]
}

➡️ confirmed = credit · pending = wait · ignored = below minimum

Ví dụ 4

Withdraw coins

Tình huống: Withdraw USDT to your own wallet

Yêu cầu
POST /v1/crypto/withdrawals
{
  "asset": "USDT-TRC20",
  "to_address": "T…your address…",
  "amount": "100"
}

➡️ Always check the address matches the network; wrong-network transfers can't be recovered

  • 💸 Withdrawal fees: funds received through the API pay 3.5% per withdrawal; wallets you create yourself in the merchant portal pay 2.5%. Taken from the withdrawn coin, not credits; deposits are free (live rate: withdraw_fee_percent in GET /v1/crypto/assets).

🚦 Trạng thái hệ thống (GET /status)

Kiểm tra API có bình thường không bất cứ lúc nào — không cần key

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

  • 🟢 ok = bình thường
  • 🟠 busy = lưu lượng cao
  • 🔴 slow = hơi chậm
  • Đo từ yêu cầu thật trong 5 phút gần nhất, theo từng dịch vụ (services[]). Xác minh/nạp bằng biên lai được đo trên mọi nhà cung cấp dự phòng, trạng thái từng tuyến trong routes[]
  • Không cần API key, gọi được từ trình duyệt (mở CORS), cache 15 giây — nên kiểm tra tối đa 1 lần/phút
  • Khi busy/slow, tăng timeout lên 15–20 giây và thử lại với cùng Idempotency-Key — không bị tính phí hai lần
  • Cũng hiển thị ở góc trên bên phải tungkao.com
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"
  }
}

🛡️ Cam kết ổn định: tích hợp một lần, chạy mãi

  • API /v1 được khóa vĩnh viễn: không xóa, không đổi tên, không đổi kiểu — chỉ thêm trường hoặc endpoint mới. Kiểm thử hợp đồng tự động chặn mọi lần triển khai làm hỏng mã cũ.
  • Khi nhà cung cấp (ngân hàng, LINE, Google, Facebook, TikTok, Discord, Telegram, blockchain) thay đổi, chúng tôi xử lý ở máy chủ — mã của bạn giữ nguyên. Kiểm tra biên lai tự chuyển dự phòng giữa 3 nhà cung cấp.
  • Viết mã bền vững: bỏ qua trường lạ, phân nhánh theo error.code (không theo câu chữ), coi status mới chưa biết là “chưa đạt/đang chờ”.
  • Nếu có gì phải ngừng, chúng tôi báo trước ít nhất 12 tháng qua header Deprecation / Sunset trong mọi phản hồi, email và webhook — cách cũ vẫn chạy tới ngày đó.
  • Mọi phản hồi có header X-Tungkao-Api-Version ghi phiên bản và ngày sửa đổi mới nhất. Toàn bộ lịch sử: /changelog.json

🏷️ Yêu cầu ghi nguồn TUNGKAO

  • Mọi trang dùng dịch vụ TUNGKAO phải hiển thị rõ “Powered by TUNGKAO” hoặc “Secured by TUNGKAO” và liên kết tới https://tungkao.com
  • Đặt gần chức năng; không ẩn, không trùng màu nền, không quá nhỏ
  • Nút từ trang “Nút đăng nhập” đã tự kèm ghi nguồn; trang đăng nhập của TUNGKAO cũng tự hiển thị
  • Ví dụ: <a href="https://tungkao.com" target="_blank" rel="noopener">Powered by TUNGKAO</a>
  • Muốn bỏ ghi nguồn (white-label) cần được phê duyệt trước

Powered by TUNGKAO