🎟 Coupon Admin
Admin · จัดการคูปอง — Import จาก Sheet + Drive folder link
📊 สรุปยอดขาย
ยอดรวมทั้งหมด
0 ฿
0 ครั้ง
📥 Import Coupons จาก Google Sheet
สร้าง tab ชื่อ Coupons ใน Google Sheet ที่ระบบเชื่อมไว้
หัวคอลัมน์: name · barcode · price · stock
📁 Google Drive Folder (สำหรับเก็บสลิปโอนเงิน)
วาง URL ของ Google Drive folder ที่ต้องการให้ระบบ upload สลิปไป
🔐 Google Drive OAuth — ใช้บัญชี Gmail ของคุณ
Service Account ไม่มี storage quota ของตัวเอง → ต้อง ใช้ OAuth ผูกบัญชี Gmail
เพื่อให้ระบบ upload เข้าสู่ Drive ของคุณได้ (ใช้ quota 15 GB ฟรี)
ทำครั้งเดียว — refresh_token จะถูกเก็บไว้ใน DB
⚙️ ตั้งค่า OAuth Client (Client ID / Secret / Redirect URI)
วิธีสร้าง OAuth Client:
1. ไป
Google Cloud Console → Credentials
2.
Create credentials →
OAuth client ID → Application type:
Web application
3.
Authorized redirect URIs: ใส่ URL ที่ใช้เปิดหน้า admin นี้ +
/admin/coupon/oauth/callback
ตัวอย่าง:
http://localhost:8001/admin/coupon/oauth/callback
หรือ:
https://<tunnel>.trycloudflare.com/admin/coupon/oauth/callback
4. กด Create → คัดลอก
Client ID และ
Client Secret มาใส่ด้านล่าง
5. ที่
OAuth consent screen
→ Add yourself as
Test User ถ้ายังเป็น Testing mode
🎟 รายการคูปอง + ยอดขายแยกชนิด (0)
— ยังไม่มีคูปอง — ใช้ Import เพื่อนำเข้าจาก Google Sheet