บัญชี — ประวัติธุรกรรม
หน้า Account → Transaction History แสดงการเคลื่อนไหวยอด (เติม โอน หักงาน AI คืนเงิน) ของ user ที่ลงชื่อเข้าใช้ Integrator เรียก upstream ด้วย access_token ของ user
ใช้ โดเมนลงทะเบียน ใน form — ไม่ใช่ hostname ของ API
ไม่ใช่ usage-history
สถิติต่อ job: POST /api/v2/usage-history ประวัติธุรกรรมคือ ledger กระเป๋า (paymentsHistory) ดู Usage history (preview)
Playground & Profile
Playground — Home feed → แพลตฟอร์ม → ประวัติธุรกรรม เมื่อรัน npm run docs:stack Profile → Account โหลดตัวอย่าง ledger ล่าสุดได้เมื่อลงชื่อเข้าใช้แล้ว
Upstream ledger
POST https://api.gommo.net/api/apps/go-mmo/users/paymentsHistory
Content-Type: application/x-www-form-urlencoded
| Field | จำเป็น | หมายเหตุ |
|---|---|---|
access_token | ใช่ | โทเค็น session user |
domain | ใช่ | โดเมนลงทะเบียน |
limit | ใช่ | UI dealer มัก 500 (สูงสุดต่อ request) |
time_start | ใช่ | Unix timestamp; 0 = ไม่จำกัดด้านล่าง (all time) |
time_end | ใช่ | Unix timestamp; 0 = ไม่จำกัดด้านบน |
currency_name | ไม่บังคับ | ว่าง = ทุกประเภท; เช่น credits_ai |
source | ไม่บังคับ | กรอง key ledger; ว่าง = ทั้งหมด |
language | ไม่บังคับ | เช่น EN, TH |
device_id, device_name, device_info | ไม่บังคับ | เหมือน login / โอน credit |
PowerShell (แทน domain; ใช้ token จริงเฉพาะใน session ที่ปลอดภัย):
$domain = $env:GOMMO_API_DOMAIN
if (-not $domain) { throw 'Set GOMMO_API_DOMAIN to your registration domain' }
$h = @{ 'Content-Type' = 'application/x-www-form-urlencoded' }
$body = "access_token=$env:TOKEN&domain=$domain&limit=500¤cy_name=&source=&time_start=0&time_end=0&language=EN"
Invoke-RestMethod -Method Post -Uri 'https://api.gommo.net/api/apps/go-mmo/users/paymentsHistory' -Headers $h -Body $bodycurl.exe (Windows — ตั้ง env ก่อน):
curl.exe -X POST "https://api.gommo.net/api/apps/go-mmo/users/paymentsHistory" ^
-H "Content-Type: application/x-www-form-urlencoded" ^
--data-urlencode "access_token=%TOKEN%" ^
--data-urlencode "domain=%REGISTRATION_DOMAIN%" ^
--data-urlencode "limit=500" ^
--data-urlencode "currency_name=" ^
--data-urlencode "source=" ^
--data-urlencode "time_start=0" ^
--data-urlencode "time_end=0" ^
--data-urlencode "language=EN"รูปแบบ response
ตัวอย่างสำเร็จ:
{
"data": [
{
"fluctuation_type": "minus",
"value_change": 720,
"value_last": 487900,
"currency_name": "credits_ai",
"source": "createImageSeedream45WithAICredit",
"message": "Create image with AI Credit [GPT Image 2 - low]",
"created_time": 1789442037,
"id_base": "03883f3e0cbb4aaa"
}
],
"runtime": 0.12
}| Field | ความหมาย |
|---|---|
fluctuation_type | plus (เข้า) หรือ minus (ออก) |
value_change | จำนวน (ค่าบวก) |
value_last | ยอดหลังแถวนี้ |
source | key ledger — เช่น sendBalances, receivedBalances, chatAiUsage, refundAICreditCreateVideoError |
object_id | id job/pool ที่เกี่ยวข้อง (ถ้ามี) |
from_user | คู่สัญญาในบางแถว P2P |
สรุปฝั่ง client (UI dealer): รวม value_change เมื่อ plus → รวมเข้า; minus → รวมออก; net = เข้า − ออก จัดกลุ่มตาม source สำหรับตาราง “By source”
โอน P2P: sendBalances (หัก), receivedBalances (บวก) ดู โอน credit
Mode B (gateway ทางเลือก)
POST {gateway}/gateway/credits/transactions — ต้องมี Bearer; JSON body:
{
"limit": 500,
"currency_name": "",
"source": "",
"time_start": 0,
"time_end": 0,
"language": "EN",
"device_id": "…",
"device_name": "Browser 1",
"device_info": "{\"device_type\":\"desktop\"}"
}เซิร์ฟเวอร์เติม access_token และ domain จาก Bearer + tenant ไม่ส่ง limit → gateway ใช้ค่าเริ่มต้น 500 device_* ไม่บังคับเหมือน login; Playground ส่ง device ของเบราว์เซอร์ใน JSON
- JSON upstream ถูกต้อง → pass-through (HTTP status และ body เดิม มัก
{ data, runtime }) - body ว่างหรือ non-JSON upstream → gateway JSON
{ success: false, code: "UPSTREAM_ERROR", raw: { http_status, body? } }
OpenAPI: openapi.yaml — /gateway/credits/transactions
SDK: @ai-gateway/client — auth.listPaymentsHistory() ดู SDK authentication
→ โอน credit · เปลี่ยนรหัสผ่าน · อุปกรณ์เซสชัน · ตั๋วซัพพอร์ต · โปรแกรมพาร์ทเนอร์ · Creator Rewards · Endpoint map · Deploy → Self-host (advanced)
