Skip to content

การเรียกเก็บเงิน — แพลตฟอร์ม Gommo (preview) ​

Coming to Gommo platform

UX billing รวมบนไซต์ (/th/billing/*, portal credits) เป็น preview ของสิ่งที่ Gommo จะ ship API การชำระเงิน Gommo มี upstream แล้ว — gateway wrapper ไม่ใช่ สัญญาระยะยาว

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

แยกจาก /gateway — เติมเครดิตผ่าน Gommo เติมเครดิต (ค่าเริ่มต้น) หรือ PayOS legacy + sendBalances ภายใน

Env ​

ตัวแปรวัตถุประสงค์
GOMMO_API_DOMAINDomain ส่งไป Gommo (create_payment ค่าเริ่มต้น <registration-domain>)
TOPUP_ORDERS_FILEแผนที่ order JSON (ค่าเริ่มต้น data/topup-orders.json)
PAYOS_CLIENT_IDPayOS legacy เท่านั้น
PAYOS_API_KEYPayOS legacy เท่านั้น
PAYOS_CHECKSUM_KEYPayOS legacy + ตรวจ webhook
PAYOS_WEBHOOK_URLลงทะเบียนที่ my.payos.vn → https://api…/billing/webhook/payos
GOMMO_ACCESS_TOKENfulfillment legacy ผ่าน sendBalances

Endpoints ​

MethodPathAuthโหมด
GET/th/billing/status——
GET/th/billing/packages——
POST/th/billing/payment/createBearer userGommo
POST/th/billing/payment/syncBearer userGommo
GET/th/billing/topup/ordersBearer userประวัติในเครื่อง
GET/th/billing/topup/orders/:orderCode—ค้นหาในเครื่อง
POST/th/billing/topup/createBearer userPayOS legacy
GET/POST/th/billing/webhook/payosPayOS signatureLegacy

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

bash
curl.exe -X POST "http://localhost:3001/billing/payment/create" ^
  -H "Authorization: Bearer USER_TOKEN" ^
  -H "Content-Type: application/json" ^
  -d "{\"username\":\"gommo_user\",\"packageId\":\"basic-member\",\"invoiceBuyer\":{\"type\":\"consumer\",\"name\":\"Bán cho người tiêu dùng\",\"email\":\"\"}}"

ฟิลด์ response (ส่งต่อจาก Gommo):

ฟิลด์คำอธิบาย
orderCode / contentหมายเหตุโอน (SP…)
qrImage / qrFallbackURL รูป QR โอนเงิน
holder, acc, bank, storeรายละเอียดโอนเงิน
amountVnd, amountBaseVnd, vatAmountVndแยกยอดเรียกเก็บ
paymentServerเช่น sepay

ฟิลด์ body ทางเลือก: promoCode, referralCode (และ invoiceBuyer.referral_code สำหรับใบแจ้งหนี้บุคคล)

Sync การชำระเงิน ​

bash
curl.exe -X POST "http://localhost:3001/billing/payment/sync" ^
  -H "Authorization: Bearer USER_TOKEN" ^
  -H "Content-Type: application/json" ^
  -d "{\"orderCode\":\"SP...\"}"

เมื่อ data.paid เป็น true gateway ทำเครื่องหมาย order ในเครื่องเป็น credited

เติมเครดิต PayOS legacy ​

POST /billing/topup/create สร้าง checkout PayOS และเก็บ orderCode ตัวเลข webhook PAID เรียก sendCreditsToUser() ภายใน

แพ็กเครดิต ​

ดู GET /billing/packages หรือ src/services/creditPackages.ts แต่ละแพ็ก map ไป Gommo credit_plans key ส่งเป็น gommoIdBase ใน create_payment (credit-basic, credit-agency, …) amountVnd เป็นราคาก่อน VAT (priceVND บน Gommo platform /th/prices) checkout เพิ่ม VAT 5%