Skip to content

Billing & เครดิต — แพลตฟอร์ม Gommo (preview) ​

Coming to Gommo platform

Portal credits และ /th/billing/* บนไซต์ preview UX เติมเงินรวมสำหรับ Gommo billing อย่างเป็นทางการจะ ship บน Gommo — ไม่ใช่ความต้องการ self-host ถาวร

→ Roadmap แพลตฟอร์ม Gommo

เติมเครดิต ผู้ใช้ปลายทางผ่าน Gommo (create_payment + โอนเงินผ่านธนาคาร) — แยกจาก API generation ของ /gateway

เส้นทางค่าเริ่มต้น proxy API subscriptions ของ Gommo เครดิตเติมโดย Gommo upstream หลังโอนเงิน gateway poll payment_sync จาก client

UI Portal: /th/app/credits/ — KPI ยอดคงเหลือ แพ็กเติมเครดิต modal checkout และประวัติเติมเครดิต ลิงก์ไป Activity Billing และ เอกสาร billing

ภาพรวม ​

แอปผู้ใช้ ──► POST /billing/payment/create (Bearer user)
                └── Gommo เติมเครดิต + order code (SP…)
                        └── poll payment_sync ──► paid: true → Gommo เติมเครดิตผู้ใช้

Legacy PayOS + sendBalances (POST /billing/topup/create) ยังมีเมื่อตั้ง PAYOS_* สำหรับ fulfillment ที่ merchant ควบคุม

สิ่งที่ต้องมี ​

ข้อกำหนดEnv / หมายเหตุ
Gommo domainGOMMO_API_DOMAIN (ดู .env.example)
Session ผู้ใช้Bearer จาก /th/ai/login — เหมือน API generation
ฟิลด์ devicedevice_id, device_name, device_info (portal ส่งอัตโนมัติ)
Legacy PayOS (ทางเลือก)PAYOS_* + GOMMO_ACCESS_TOKEN สำหรับ /th/billing/topup/create

ตรวจ config:

http
GET /billing/status

คืน billingMode: "gommo", gommoPayment: true และ payosConfigured ทางเลือก

แพ็กเกจ ​

http
GET /billing/packages

คืนแพ็กเครดิต (id, amountVnd, credits, gommoIdBase) กำหนดใน server creditPackages.ts

สร้างการชำระเงิน (Gommo) ​

http
POST /billing/payment/create
Authorization: Bearer {user_access_token}
Content-Type: application/json

{
  "username": "gommo_username_from_/ai/me",
  "packageId": "basic-member",
  "invoiceBuyer": {
    "type": "consumer",
    "name": "Bán cho người tiêu dùng",
    "email": ""
  },
  "promoCode": "OPTIONAL",
  "referralCode": "OPTIONAL"
}

Response มี URL รูป QR โอนเงิน ฟิลด์โอน (holder, acc, bank, content) VAT breakdown และ orderCode

Gateway เก็บ order ในเครื่อง (TOPUP_ORDERS_FILE) สำหรับประวัติ

Poll สถานะการชำระเงิน ​

http
POST /billing/payment/sync
Authorization: Bearer {user_access_token}
Content-Type: application/json

{ "orderCode": "SP..." }

Poll ทุก ~3.5s จน data.paid === true Gommo เติมเครดิตผู้ใช้อัตโนมัติ

ประวัติ order ​

http
GET /billing/topup/orders?username={}&limit=20
Authorization: Bearer {user_access_token}

คืน order ในเครื่องสำหรับ Gommo และ legacy PayOS สถานะ: pending, paid, credited, failed

เทียบกับ /gateway ​

Pathวัตถุประสงค์
/gateway/*ใช้เครดิต (โมเดล งาน แชท …)
/th/billing/*เติมเครดิต (Gommo เติมเครดิต หรือ legacy PayOS)

ห้าม mount logic billing ใต้ /gateway

อ้างอิงฉบับเต็ม ​

→ อ้างอิง Billing API
→ คู่มือ: Gommo เติมเครดิต

ถัดไป ​

→ FAQ · การยืนยันตัวตน