Skip to content

Authentication

GameSO API ใช้ API Key ในการยืนยันตัวตน โดยส่งผ่าน HTTP Header ทุก request

วิธีใช้งาน

ส่ง API Key ผ่าน header X-API-Key ทุก request:

http
X-API-Key: your_api_key_here

ตัวอย่าง

bash
curl -X POST https://api.gameso.io/v1/orders \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{ ... }'
javascript
const response = await fetch('https://api.gameso.io/v1/orders', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here',
  },
  body: JSON.stringify({ ... }),
})
python
import requests

headers = {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here',
}

response = requests.post(
    'https://api.gameso.io/v1/orders',
    headers=headers,
    json={ ... }
)
php
$ch = curl_init('https://api.gameso.io/v1/orders');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'X-API-Key: your_api_key_here',
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([...]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

ขอ API Key

ติดต่อทีม GameSO เพื่อขอ API Key สำหรับ Merchant ของคุณ

สำคัญ

  • เก็บ API Key ไว้เป็นความลับ อย่า commit ลง version control
  • ใช้ environment variable แทนการ hardcode ใน code
  • หาก API Key รั่วไหล ติดต่อทีม GameSO ทันทีเพื่อออก Key ใหม่

Error เมื่อ Authentication ล้มเหลว

หาก API Key ไม่ถูกต้องหรือไม่ได้ส่งมา ระบบจะตอบกลับ:

json
HTTP/1.1 401 Unauthorized

{
  "status": 401,
  "code": "UNAUTHORIZED",
  "message": "Invalid or missing API key"
}

GameSO API Documentation