🚀 API Documentation

Hướng dẫn chi tiết API tự động mua hàng

Quản lý API Keys

Bắt đầu

API tự động mua hàng cho phép bạn tích hợp chức năng mua hàng vào website hoặc ứng dụng của riêng bạn.

Yêu cầu
  • Có tài khoản đã đăng ký trên hệ thống
  • Có API Key (tự động tạo khi đăng ký)
  • Đủ số dư trong tài khoản

Base URL

https://tedexe.shop/api/

Xác thực (Authentication)

Tất cả các API request đều cần API Key để xác thực. Bạn có thể lấy API Key tại trang Quản lý API Keys.

Bảo mật
  • 🔒 Không bao giờ chia sẻ API Key công khai
  • 🔑 Mỗi API Key gắn liền với tài khoản của bạn
  • ⚡ Có thể bật/tắt hoặc xóa API Key bất cứ lúc nào
  • 🔄 Tạo nhiều API Keys cho các mục đích khác nhau

Cách sử dụng

Gửi API Key trong body của request dưới dạng JSON:

{
  "api_key": "your_64_character_api_key_here",
  ...
}

Endpoints

Tự động mua hàng

POST
https://tedexe.shop/api/auto-purchase.php

Mô tả: Mua sản phẩm tự động và nhận thông tin tài khoản ngay lập tức.

Parameters:

Tên Loại Bắt buộc Mô tả
api_key string Required API Key của bạn (64 ký tự)
product_id integer Required ID sản phẩm muốn mua
quantity integer Optional Số lượng (mặc định: 1)

Responses:

Success (200)

{
  "success": true,
  "message": "Mua hàng thành công!",
  "data": {
    "order_id": 123,
    "order_code": "AUTO1699123456",
    "product_name": "Tài khoản Free Fire",
    "quantity": 1,
    "total": 50000,
    "accounts": [
      "username1|password1"
    ],
    "remaining_balance": 950000
  }
}

Error (4xx/5xx)

{
  "success": false,
  "message": "API key không hợp lệ!"
}

// Hoặc

{
  "success": false,
  "message": "Số dư không đủ!",
  "balance": 10000,
  "required": 50000
}
Error Codes
  • API key không hợp lệ: API key sai hoặc đã bị vô hiệu hóa
  • Sản phẩm không tồn tại: Product ID không có trong hệ thống
  • Sản phẩm hết hàng: Không còn tài khoản để bán
  • Số dư không đủ: Tài khoản không có đủ tiền

Ví dụ Code

PHP

PHP
<?php
$url = 'https://tedexe.shop/api/auto-purchase.php';

$data = [
    'api_key' => 'your_64_character_api_key_here',
    'product_id' => 1,
    'quantity' => 1
];

$options = [
    'http' => [
        'header' => "Content-type: application/json\r\n",
        'method' => 'POST',
        'content' => json_encode($data)
    ]
];

$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);

if ($response['success']) {
    echo "✅ Mua hàng thành công!\n";
    echo "Order Code: " . $response['data']['order_code'] . "\n";
    echo "Tài khoản:\n";
    print_r($response['data']['accounts']);
} else {
    echo "❌ Lỗi: " . $response['message'] . "\n";
}
?>

JavaScript (Node.js)

JavaScript
const axios = require('axios');

const data = {
  api_key: 'your_64_character_api_key_here',
  product_id: 1,
  quantity: 1
};

axios.post('https://tedexe.shop/api/auto-purchase.php', data)
  .then(response => {
    if (response.data.success) {
      console.log('✅ Mua hàng thành công!');
      console.log('Order Code:', response.data.data.order_code);
      console.log('Tài khoản:', response.data.data.accounts);
    } else {
      console.log('❌ Lỗi:', response.data.message);
    }
  })
  .catch(error => {
    console.error('Error:', error);
  });

Python

Python
import requests
import json

url = 'https://tedexe.shop/api/auto-purchase.php'

data = {
    'api_key': 'your_64_character_api_key_here',
    'product_id': 1,
    'quantity': 1
}

response = requests.post(url, json=data)
result = response.json()

if result['success']:
    print('✅ Mua hàng thành công!')
    print('Order Code:', result['data']['order_code'])
    print('Tài khoản:', result['data']['accounts'])
else:
    print('❌ Lỗi:', result['message'])

cURL

Bash
curl -X POST "https://tedexe.shop/api/auto-purchase.php" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "your_64_character_api_key_here",
    "product_id": 1,
    "quantity": 1
  }'

Best Practices

Khuyến nghị
  • ✅ Luôn kiểm tra success trong response trước khi xử lý
  • ✅ Xử lý lỗi một cách thích hợp (try-catch)
  • ✅ Lưu trữ API Key an toàn (environment variables)
  • ✅ Kiểm tra số dư trước khi gọi API
  • ✅ Log tất cả transactions để theo dõi
Tránh
  • ❌ Hard-code API Key trong code
  • ❌ Chia sẻ API Key công khai
  • ❌ Gửi quá nhiều request liên tục (spam)
  • ❌ Không kiểm tra response trước khi sử dụng

Hỗ trợ

Nếu bạn gặp vấn đề hoặc cần hỗ trợ thêm: