รับเงิน (Billing)
Credits & entitlements
ขายแพ็กเครดิต/ปลดล็อกฟีเจอร์ แล้วตรวจสิทธิ์ลูกค้าเพื่อ gate การใช้งาน (เหมาะกับแอป AI)
เชื่อมต่อ
key ถูกเก็บใน httpOnly cookie ฝั่ง server — JavaScript ในเบราว์เซอร์อ่านไม่ได้ · สร้าง test key ที่ Dashboard → API keys
ลองยิง — กด Run ยิงจริง (test mode)
Credit packs (AI app)
เขียนขายแพ็กเครดิต + feature flags แล้วอ่าน entitlements เพื่อ gate ฟีเจอร์
โค้ด & API
สิทธิ์ที่ลูกค้าใช้ได้ตอนนี้ — ใช้ gate ฟีเจอร์/เครดิตในแอปคุณ
Headers
AuthorizationRequiredstring
Bearer sk_test_/sk_live_
Query
idRequiredstring
customer id ใน path
curl -X GET https://api.heysub.co/v1/customers/{id}/entitlements \
-H "Authorization: Bearer sk_test_xxx" \
-H "Heysub-Version: 2026-09-01"{
"customer": "cus_01J9X",
"active_products": [
"prod_pro"
],
"feature_flags": [
"ai_pro",
"credits_1000"
],
"credits": [
{
"product": "prod_pro",
"remaining": 940
}
],
"subscriptions": []
}