Tài khoản — lịch sử giao dịch
Màn Tài khoản → Transaction History liệt kê biến động số dư (nạp, chuyển, trừ job AI, hoàn tiền) của user đã đăng nhập. Integrator gọi upstream với access_token user.
Dùng domain đăng ký trong form — không phải hostname API.
Không phải usage-history
Thống kê theo job: POST /api/v2/usage-history. Lịch sử giao dịch là sổ cái ví (paymentsHistory). Xem Lịch sử usage (preview).
Playground & Profile
Playground — Home feed → Nền tảng → Lịch sử giao dịch khi chạy npm run docs:stack. Profile → Account có thể tải xem trước ledger gần đây khi đã đăng nhập.
Upstream ledger
POST https://api.gommo.net/api/apps/go-mmo/users/paymentsHistory
Content-Type: application/x-www-form-urlencoded
| Field | Bắt buộc | Ghi chú |
|---|---|---|
access_token | có | Token session user |
domain | có | Domain đăng ký |
limit | có | UI dealer thường 500 (tối đa mỗi request) |
time_start | có | Unix timestamp; 0 = không giới hạn dưới (all time) |
time_end | có | Unix timestamp; 0 = không giới hạn trên |
currency_name | tùy | Rỗng = mọi loại; ví dụ credits_ai |
source | tùy | Lọc theo key ledger; rỗng = tất cả |
language | tùy | Ví dụ EN, VI |
device_id, device_name, device_info | tùy | Giống login / chuyển credit |
PowerShell (thay domain; chỉ dùng token thật trong session an toàn):
$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=VI"
Invoke-RestMethod -Method Post -Uri 'https://api.gommo.net/api/apps/go-mmo/users/paymentsHistory' -Headers $h -Body $bodycurl.exe (Windows — set biến môi trường trước):
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=VI"Hình dạng response
Ví dụ thành công:
{
"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 | Ý nghĩa |
|---|---|
fluctuation_type | plus (cộng) hoặc minus (trừ) |
value_change | Số lượng (độ lớn dương) |
value_last | Số dư sau dòng này |
source | Key ledger — ví dụ sendBalances, receivedBalances, chatAiUsage, refundAICreditCreateVideoError |
object_id | Id job/pool liên quan (nếu có) |
from_user | Đối tác trên một số dòng P2P |
Tóm tắt phía client (UI dealer): cộng value_change khi plus → tổng vào; minus → tổng ra; net = vào − ra. Nhóm theo source cho bảng “Theo source”.
Chuyển P2P: sendBalances (trừ), receivedBalances (cộng). Xem Chuyển credit.
Mode B (gateway tùy chọn)
POST {gateway}/gateway/credits/transactions — Bearer bắt buộc; JSON body:
{
"limit": 500,
"currency_name": "",
"source": "",
"time_start": 0,
"time_end": 0,
"language": "VI",
"device_id": "…",
"device_name": "Browser 1",
"device_info": "{\"device_type\":\"desktop\"}"
}Server điền access_token và domain từ Bearer + tenant. Bỏ limit trên gateway → mặc định 500. device_* tùy chọn giống login; Playground gửi device trình duyệt trong JSON.
- JSON upstream hợp lệ → pass-through (cùng HTTP status và body, thường
{ data, runtime }). - Body rỗng hoặc 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(). Xem SDK authentication.
→ Chuyển credit · Đổi mật khẩu · Thiết bị đăng nhập · Ticket hỗ trợ · Chương trình đối tác · Creator Rewards · Endpoint map · Deploy → Self-host (advanced)
