1 USD ≈ 27,000 credits · display only
Reference rate may change over time.
1 USD ≈ 27,000 credits · display only
Reference rate may change over time.
Coming to Gommo platform
This recipe calls /billing/* on a self-hosted Gommo Developer instance (localhost:3001) — not the public Gommo API. Unified billing UX is a preview of what Gommo will ship.
Prerequisites
Run npm run dev or npm run docs:stack with billing env configured. See Deploy.
Billing lives under /billing/* — separate from generation APIs (jobs, chat, upload).
Default mode: Gommo create_payment + client poll payment_sync. No PayOS env required on your server.
Invoke-RestMethod "http://localhost:3001/billing/status"Expect billingMode: gommo and gommoPayment: true.
$packages = Invoke-RestMethod "http://localhost:3001/billing/packages"
$packages.data | Format-Table id, name, amountVnd, credits, bonusPercentPackage ids include basic-member, vip-member, ultra-member, …
/ai/me username in the create body must match the Bearer token owner.
$domain = $env:GOMMO_API_DOMAIN; if (-not $domain) { throw 'Set GOMMO_API_DOMAIN to the user registration domain (dealer)' }
$meBody = "access_token=$env:TOKEN&domain=$domain"
$me = Invoke-RestMethod -Method POST `
-Uri "https://api.gommo.net/ai/me" `
-ContentType "application/x-www-form-urlencoded" `
-Body $meBody
$username = $me.username ?? $me.data.username
Write-Host "username=$username"$h = @{ Authorization = "Bearer $env:TOKEN"; 'Content-Type' = 'application/json' }
$body = @{
username = $username
packageId = 'basic-member'
invoiceBuyer = @{
type = 'consumer'
name = 'Bán cho người tiêu dùng'
email = ''
}
} | ConvertTo-Json -Depth 5
$payment = Invoke-RestMethod -Method POST `
-Uri "http://localhost:3001/billing/payment/create" `
-Headers $h -Body $body
$qr = $payment.data.qrImage
$orderCode = $payment.data.content ?? $payment.data.orderCode
Write-Host "QR: $qr"
Write-Host "orderCode=$orderCode"User transfers the charge amount (base + 5% VAT) with memo orderCode.
while ($true) {
$syncBody = @{ orderCode = $orderCode } | ConvertTo-Json
$sync = Invoke-RestMethod -Method POST `
-Uri "http://localhost:3001/billing/payment/sync" `
-Headers $h -Body $syncBody
if ($sync.data.paid) { Write-Host 'Paid!'; break }
Start-Sleep -Seconds 4
}Invoke-RestMethod `
-Uri "http://localhost:3001/billing/topup/orders?username=$username&limit=10" `
-Headers @{ Authorization = "Bearer $env:TOKEN" }If you run merchant-controlled fulfillment, see PayOS topup (POST /billing/topup/create).
The developer portal (/app/credits/) implements the full Gommo checkout: summary → invoice (3 tabs) → payment QR + poll.