เงิน & Ops
Webhooks & events
รับ event แบบเรียลไทม์ (source of truth) — สร้าง endpoint, ตรวจลายเซ็น, ดู delivery log
เชื่อมต่อ
key ถูกเก็บใน httpOnly cookie ฝั่ง server — JavaScript ในเบราว์เซอร์อ่านไม่ได้ · สร้าง test key ที่ Dashboard → API keys
ลองยิง — กด Run ยิงจริง (test mode)
Webhook lifecycle
เขียนcreate → test ping → delivery log → rotate secret → delete ครบวงจร
Event log tail
อ่านไล่ดู event ล่าสุดในระบบ (audit/debug)
โค้ด & API
สร้าง endpoint รับ webhook — response คืน signing_secret ครั้งเดียว (เก็บไว้ ห้าม log)
Headers
AuthorizationRequiredstring
Bearer sk_test_/sk_live_
Body
urlRequiredstring
https public URL รับ POST
enabled_eventsarray
ชนิด event ที่รับ (ว่าง = ทั้งหมด)
curl -X POST https://api.heysub.co/v1/webhook_endpoints \
-H "Authorization: Bearer sk_test_xxx" \
-H "Heysub-Version: 2026-09-01" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"url":"https://app.example/webhooks/heysub","enabled_events":["payment.succeeded","invoice.paid"]}'{
"id": "we_01J9X",
"url": "https://app.example/webhooks/heysub",
"signing_secret": "whsec_… (แสดงครั้งเดียว)",
"enabled_events": [
"payment.succeeded",
"invoice.paid"
]
}