🔌 Developer API & Webhooks

Tài Liệu Tích Hợp API

Tích hợp đổi thẻ cào tự động sang USDT BEP20 cho website, ứng dụng hoặc Telegram Bot của bạn với tốc độ < 30 giây.

🔒 1. Xác thực (Authentication)

💡 $ENDPOINT là API Gateway URL — được cung cấp riêng sau khi tạo tài khoản. Liên hệ admin qua Telegram để nhận.

Tất cả API ngoại trừ GET /api/rate đều yêu cầu 2 header bắt buộc:
X-API-Key: API Key lấy từ tab Quản lý API Key
X-API-Secret: Secret Key (chỉ hiển thị 1 lần khi tạo)

# Thiết lập endpoint (nhận từ admin) export ENDPOINT="your_api_endpoint" # Ví dụ xác thực cơ bản curl -X GET "$ENDPOINT/api/user/me" \ -H "X-API-Key: dtusdt_live_xxxxxxxxxxxxxxxx" \ -H "X-API-Secret: sec_xxxxxxxxxxxxxxxxxxxxxxxx"
GET /api/rate PUBLIC — Tỷ giá USDT/VND realtime (Binance P2P)
curl -X GET "$ENDPOINT/api/rate" // Response (200 OK) { "vndPerUsdt": 26290, "source": "live", "provider": "binance_p2p", "updatedAt": 1785476237649 }
GET /api/user/me — Thông tin tài khoản & số dư
curl -X GET "$ENDPOINT/api/user/me" \ -H "X-API-Key: dtusdt_live_xxx" \ -H "X-API-Secret: sec_xxx" // Response (200 OK) { "id": "usr_xxx", "username": "tenban", "usdtBalance": 125.50, "vndDeposited": 5000000, "feePercent": 4.5, "walletAddress": "0xABC..." }
POST /api/card/submit — Nộp thẻ cào (gạch tự động)

Body (JSON):
telco: VIETTEL | VINAPHONE | MOBIFONE | VIETNAMOBILE | ZING | VCOIN | GARENA
amount: Mệnh giá thẻ (VND) — ví dụ: 10000, 20000, 50000, 100000, 200000, 500000
pin: Mã thẻ (chuỗi số)
serial: Số serial thẻ

curl -X POST "$ENDPOINT/api/card/submit" \ -H "X-API-Key: dtusdt_live_xxx" \ -H "X-API-Secret: sec_xxx" \ -H "Content-Type: application/json" \ -d '{"telco":"VIETTEL","amount":100000,"pin":"123456789012","serial":"987654321098"}' // Response (200 OK) { "success": true, "requestId": "req_884920482", "status": "processing", "telco": "VIETTEL", "amount": 100000, "message": "Thẻ đã được tiếp nhận và đang xử lý" }
GET /api/card/status/:requestId — Kiểm tra kết quả thẻ
curl -X GET "$ENDPOINT/api/card/status/req_884920482" \ -H "X-API-Key: dtusdt_live_xxx" \ -H "X-API-Secret: sec_xxx" // Response (200 OK) { "requestId": "req_884920482", "status": "success", // success | failed | processing "receivedVnd": 85000, // VND thực nhận sau khi gạch "usdtAmount": 3.26, "netUsdt": 3.10, // USDT sau phí "feePercent": 5 }
GET /api/transactions — Lịch sử giao dịch nạp thẻ

Query params: ?page=1&limit=20

curl -X GET "$ENDPOINT/api/transactions?page=1&limit=10" \ -H "X-API-Key: dtusdt_live_xxx" \ -H "X-API-Secret: sec_xxx" // Response (200 OK) { "transactions": [ { "id": "tx_xxx", "status": "success", "usdtAmount": 3.26, ... } ], "total": 45, "page": 1 }
POST /api/withdraw — Rút USDT về ví BEP20

Body (JSON):
walletAddress: Địa chỉ ví BEP20 (BNB Chain)
amount: Số USDT muốn rút (tối thiểu 20 USDT)
withdrawPassword: Mật khẩu rút tiền

curl -X POST "$ENDPOINT/api/withdraw" \ -H "X-API-Key: dtusdt_live_xxx" \ -H "X-API-Secret: sec_xxx" \ -H "Content-Type: application/json" \ -d '{"walletAddress":"0x...","amount":50,"withdrawPassword":"matkhauruttien"}' // Response (200 OK) { "success": true, "withdrawId": "wd_992019", "status": "processing", "amount": 50, "netAmount": 49.00, "txHash": "0x8f2a..." }

⚠️ Mã lỗi phổ biến

HTTP CodeÝ nghĩaCách xử lý
200Thành côngĐọc response body
400Dữ liệu gửi lên sai / thiếuKiểm tra lại body JSON
401API Key không hợp lệKiểm tra X-API-Key & X-API-Secret
403Không có quyềnKiểm tra permissions của API Key
429Gọi quá nhiều requestGiảm tần suất, đợi 1 giây
500Lỗi serverThử lại sau 30 giây

⏱️ Rate Limits

/api/rate: Không giới hạn (public)
Các API khác: Tối đa 60 request/phút mỗi API Key
• Khi vượt quá sẽ nhận HTTP 429 — vui lòng retry sau 1 giây

🏠 Đổi thẻ 📊 Tài khoản 💸 Rút tiền 📋 Lịch sử