TUNGKAO ឯកសារ API
🏦
API · slip_deposit

បញ្ចូលប្រាក់តាមវិក្កយបត្រ

បញ្ចូលប្រាក់សម្រាប់អ្នកប្រើ៖ ពិនិត្យវិក្កយបត្រ កត់ត្រាការបញ្ចូលរបស់អ្នកនោះ ហើយជូនដំណឹងតាម webhook

🕒 ធ្វើបច្ចុប្បន្នភាពចុងក្រោយ: ម៉ោងប្រទេសថៃ (UTC+07:00) · ✅ កូដចាស់នៅដំណើរការ មិនចាំបាច់កែ

🤖 ឱ្យ AI សរសេរកូដភ្ជាប់

ចម្លងតំណនេះឱ្យ AI អាន ឬចុចប៊ូតុង ប្រព័ន្ធនឹងចម្លងពាក្យបញ្ជា ហើយបើក AI

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

តំណនេះផ្ដល់បច្ចុប្បន្នភាពរបស់ API នេះជា JSON (មិនត្រូវការ key បើកពីគ្រប់ដែន)។ បង្ហាញក្នុងទំព័រគ្រប់គ្រងជាប្រអប់ “ប្រកាសបច្ចុប្បន្នភាព” ហើយដាក់ “ថ្មី” ពេល last_updated ប្ដូរ

ChatGPT ↗Claude ↗Gemini ↗Grok ↗

ចម្លង + បើកក្នុង: ចុចប៊ូតុង AI ប្រព័ន្ធនឹងចម្លងពាក្យបញ្ជា បើប្រអប់ជជែកទទេ គ្រាន់តែបិទភ្ជាប់

🔑 key ដែលត្រូវប្រើ

បង្កើត key slip_deposit នៅផតថលអាជីវករ (API key) ហើយផ្ញើ header នេះគ្រប់សំណើ — key សេវាផ្សេងមិនដំណើរការនៅទីនេះ

Authorization: Bearer $TUNGKAO_KEY

📋 ជំហាន

  1. កំណត់គណនីទទួល និង URL webhook លើ key នៅផតថល
  2. ផ្ញើវិក្កយបត្រជាមួយ customer_ref (លេខអ្នកប្រើរបស់អ្នក)
  3. ពេលទទួល webhook deposit.succeeded (ពិនិត្យហត្ថលេខា) បញ្ចូលប្រាក់ឱ្យអ្នកប្រើ

📡 ការហៅ 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=… ពិនិត្យមុនជឿទិន្នន័យ (សម្ងាត់ webhook បង្ហាញពេលកំណត់ 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]));
}

📚 ឧទាហរណ៍ការប្រើ

ឧទាហរណ៍ 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 តាមសេវា (មិនត្រូវការ key)
  4. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    កុងតាក់បើក/បិទ key និងម៉ោងប្ដូរ + គេហទំព័រ 1 key 1 សម្រាប់សេវានីមួយៗ
  5. កែលម្អ ម៉ោងប្រទេសថៃ (UTC+07:00)
    ចាក់សោ API v1 ជាអចិន្ត្រៃយ៍ (បន្ថែមតែប៉ុណ្ណោះ) + header X-Tungkao-Api-Version + ជូនដំណឹងមុន 12 ខែ
  6. ឯកសារ ម៉ោងប្រទេសថៃ (UTC+07:00)
    ទំព័រឯកសារតាម API និងតំណ AI (10 ភាសា)
  7. សុវត្ថិភាព ម៉ោងប្រទេសថៃ (UTC+07:00)
    ផ្ទៀងផ្ទាត់ domain តាម API key (key 1 = គេហទំព័រ 1) — key ចាស់នៅដំណើរការ
  8. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    ចុះហត្ថលេខា HMAC ជាជម្រើស — មិនបើកក៏ដូចដើម
  9. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    រយៈពេល API key ការជូនដំណឹង និងការបន្ត — key ដដែល
  10. បន្ថែម ម៉ោងប្រទេសថៃ (UTC+07:00)
    key របៀប test (សាកល្បង ឥតគិតថ្លៃ) គ្រប់សេវា
  11. ថ្មី ម៉ោងប្រទេសថៃ (UTC+07:00)
    បើកការបញ្ចូលប្រាក់តាមវិក្កយបត្រ + webhook

✅ កូដចាស់នៅដំណើរការ មិនចាំបាច់កែ

🛡️ ការសន្យាស្ថិរភាព៖ ភ្ជាប់ម្ដង ប្រើបានជានិច្ច

🚦 ស្ថានភាពប្រព័ន្ធ (GET /status)

ពិនិត្យថា API ធម្មតាឬទេ គ្រប់ពេល — មិនត្រូវការ key

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