الحصول على حالة الفواتير
curl --request GET \
--url https://api.truthlocks.com/v1/billing/status \
--header 'X-API-Key: <api-key>'const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/billing/status', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/billing/status"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/billing/status"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"plan": "<string>",
"status": "<string>",
"trial_ends_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}الفوترة
الحصول على حالة الفواتير
يعرض حالة الفوترة الحالية، ووضع الميزة، وفترة السماح للمستأجر الموثق.
GET
/
v1
/
billing
/
status
الحصول على حالة الفواتير
curl --request GET \
--url https://api.truthlocks.com/v1/billing/status \
--header 'X-API-Key: <api-key>'const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/billing/status', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/billing/status"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/billing/status"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"plan": "<string>",
"status": "<string>",
"trial_ends_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}GET /v1/billing/status
feature_mode هو NORMAL و grace_until هو null. إذا فشلت دفعة، يدخل الحساب في سير عمل وصول متدرج — متدهور، مقيد، ثم معلق — مع فترة سماح في كل مرحلة.
الاستجابة
مستوى إمكانية الميزة الحالي:
NORMAL— جميع الميزات متاحةDEGRADED— فشل الدفع؛ لا تزال جميع الميزات تعمل خلال فترة السماحRESTRICTED— فترة السماح على وشك الانتهاء؛ عمليات الكتابة (السك، إنشاء المفاتيح) معطلةSUSPENDED— انتهت فترة السماح؛ تم تعطيل جميع وصول API حتى يتم حل مشكلة الدفع
رسالة قابلة للقراءة من قبل الإنسان تصف الإجراء المطلوب، أو
null عندما لا يكون هناك حاجة لإجراء.متى تستخدم نقطة النهاية هذه
استخدمGET /v1/billing/status لـ:
- عرض مطالبات الدفع — تحقق من
feature_modeعند بدء تشغيل التطبيق أو تسجيل الدخول واعرض لافتة عندما تكون القيمة أي شيء آخر غيرNORMAL. - حماية عمليات الكتابة - قبل السك أو إنشاء المفاتيح، تحقق من أن
feature_modeليسRESTRICTEDأوSUSPENDED. - تتبع مهل السماح — اقرأ
grace_untilلتظهر لمستخدميك بالضبط المدة المتبقية لديهم لحل مشكلة الدفع.
const res = await fetch("https://api.truthlocks.com/v1/billing/status", {
headers: { "X-API-Key": "tl_live_..." },
});
const { feature_mode, grace_until } = await res.json();
if (feature_mode !== "NORMAL") {
showPaymentBanner(feature_mode, grace_until);
}
توقيت فترة السماح
فترات السماح الافتراضية لوضع العقد القياسي هي:| الانتقال | نافذة السماح | الإشعارات |
|---|---|---|
| عادي ← متدهور | 7 أيام | تذكيرات عند T+24 ساعة، T+48 ساعة، T+72 ساعة |
| متدهور ← مقيد | 14 يومًا | تذكيرات عند T+24 ساعة، T+48 ساعة، T+72 ساعة |
| مقيد ← معلق | فوري | إشعار تعليق نهائي |
راجع فشل الدفع وفترات السماح للحصول على تفصيل كامل لسير عمل الوصول المتدرج.

