افتح بوابة طريقة الدفع
curl --request POST \
--url https://api.truthlocks.com/v1/billing/portal \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"return_url": "https://console.truthlocks.com/settings/billing"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({return_url: 'https://console.truthlocks.com/settings/billing'})
};
fetch('https://api.truthlocks.com/v1/billing/portal', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/billing/portal"
payload = { "return_url": "https://console.truthlocks.com/settings/billing" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/billing/portal"
payload := strings.NewReader("{\n \"return_url\": \"https://console.truthlocks.com/settings/billing\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"portal_url": "<string>"
}الفوترة
افتح بوابة طريقة الدفع
إنشاء رابط بوابة Stripe قصير الأجل لحساب فوترة مسجل الدخول.
POST
/
v1
/
billing
/
portal
افتح بوابة طريقة الدفع
curl --request POST \
--url https://api.truthlocks.com/v1/billing/portal \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"return_url": "https://console.truthlocks.com/settings/billing"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({return_url: 'https://console.truthlocks.com/settings/billing'})
};
fetch('https://api.truthlocks.com/v1/billing/portal', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/billing/portal"
payload = { "return_url": "https://console.truthlocks.com/settings/billing" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/billing/portal"
payload := strings.NewReader("{\n \"return_url\": \"https://console.truthlocks.com/settings/billing\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"portal_url": "<string>"
}استخدم هذا الإجراء من Console → Settings → Billing → Payment methods أو من
صفحة فواتير المستهلك. تتطلب جلسة بشرية مسجلة الدخول. لا يمكن لمفاتيح API فتح
بوابة عملاء. تتطلب مساحات عمل الأعمال مسؤول مساحة عمل نشط
أو دور على مستوى المستأجر مع إذن إدارة الفواتير.
لمساحة عمل قائمة على الاستخدام بدون عميل Stripe مرتبط، البوابة الصريحة
يُهيئ الطلب ويربط هذا العميل باستخدام البريد الإلكتروني للحساب الموثق.
لا يؤدي فتح البوابة إلى فرض رسوم على بطاقة، أو إنشاء اشتراك، أو تغيير الخطة.
الطلب
عيّنprovider إلى stripe (الافتراضي). لا توفر Flutterwave حاليًا
بوابة الخدمة الذاتية من خلال نقطة النهاية هذه. Paystack غير مدعوم هنا.
عيّن return_url إلى عنوان HTTPS على console.truthlocks.com لعمل تجاري
جلسة أو verify.truthlocks.com لجلسة المستهلك. يتم رفض المضيفين الآخرين.
الاستجابة
portal_url هو رابط Stripe قصير الأجل. افتحه لإضافة أو تحديث تفاصيل الدفع
واطلع على فواتير Stripe المتاحة. تكوين بوابة طريقة الدفع في Truthlocks
لا تمكن تغييرات الاشتراك أو الإلغاء؛ استخدم صفحة الفواتير المناسبة
صفحة لتلك الإجراءات. تعامل مع هذا الرابط على أنه خاص واطلب رابطًا جديدًا في كل مرة.
الأخطاء
تُرجع الأخطاء JSON معcode و error. 403 يعني أن الشخص المسجل دخوله لا يستطيع
إدارة حساب الفواتير هذا. 422 يحدد مزودًا غير مدعوم. 502 أو
503 يشير إلى فشل مزود أو خدمة حساب؛ تشرح الرسالة
الخطوة التالية. لا يؤدي فشل البحث عن الحساب إلى إنشاء عميل مزود آخر.الجسم
application/json

