الانتقال إلى المحتوى الرئيسي
POST
/
workspaces
/
{workspaceId}
/
billing-accounts
/
{billingAccountId}
/
subscriptions
إنشاء اشتراك
curl --request POST \
  --url https://api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "product_quantities": {
    "locations": 5,
    "users": 25
  },
  "metadata": {
    "project_id": "proj_abc123"
  }
}'
{
  "id": "sub_a1b2c3d4e5f6g7h8",
  "billing_account_id": "cus_a1b2c3d4e5f6g7h8",
  "status": "active",
  "currency": "usd",
  "product_quantities": {
    "locations": {
      "price_id": "price_123abc",
      "quantity": 10,
      "interval": "month"
    },
    "users": {
      "price_id": "price_456def",
      "quantity": 50,
      "interval": "month"
    }
  },
  "metadata": {
    "order_id": "6735"
  },
  "current_period_start": "2025-10-15T00:00:00Z",
  "current_period_end": "2025-11-15T00:00:00Z",
  "created_at": "2025-10-15T12:30:00Z",
  "updated_at": "2025-10-20T09:00:00Z"
}

Authorizations

Authorization
string
header
required

أدخل JWT الخاص بك بالتنسيق: Bearer {token}

Path Parameters

workspaceId
string
required

معرّف مساحة العمل.

Example:

"ws_a1b2c3d4e5f6g7h8"

billingAccountId
string
required

معرّف حساب الفوترة، والذي يتوافق مع معرّف عميل Stripe (cus_...).

Example:

"cus_a1b2c3d4e5f6g7h8"

Body

application/json
product_quantities
object
required

خريطة لأنواع المنتجات القابلة للقياس (locations, users, sso) والكمية المطلوبة. مطلوب منتج واحد على الأقل.

Example:
{ "locations": 5, "users": 25 }
metadata
object

مجموعة تصل إلى 10 أزواج من المفاتيح والقيم لتخزينها مع الاشتراك.

Example:
{ "project_id": "proj_abc123" }

Response

تم إنشاء الاشتراك بنجاح.

id
string

معرّف فريد للاشتراك (معرّف اشتراك Stripe)، يبدأ بالبادئة sub_.

Example:

"sub_a1b2c3d4e5f6g7h8"

billing_account_id
string

معرّف حساب الفوترة الذي ينتمي إليه هذا الاشتراك.

Example:

"cus_a1b2c3d4e5f6g7h8"

status
enum<string>

حالة الاشتراك.

الخيارات المتاحة:
active,
past_due,
unpaid,
canceled,
incomplete,
incomplete_expired,
trialing,
paused
Example:

"active"

currency
enum<string>

رمز العملة ISO المكون من ثلاثة أحرف للاشتراك.

الخيارات المتاحة:
usd,
zar,
eur,
gbp,
aud
Example:

"usd"

product_quantities
object

خريطة لأنواع المنتجات القابلة للقياس وكمياتها المشترك بها وتفاصيل أسعارها.

Example:
{
"locations": {
"price_id": "price_123abc",
"quantity": 10,
"interval": "month"
},
"users": {
"price_id": "price_456def",
"quantity": 50,
"interval": "month"
}
}
metadata
object

مجموعة من أزواج المفاتيح والقيم التي يمكنك إرفاقها بكائن.

Example:
{ "order_id": "6735" }
current_period_start
string<date-time> | null

بداية فترة الفوترة الحالية.

Example:

"2025-10-15T00:00:00Z"

current_period_end
string<date-time> | null

نهاية فترة الفوترة الحالية.

Example:

"2025-11-15T00:00:00Z"

created_at
string<date-time> | null

الطابع الزمني لإنشاء الاشتراك.

Example:

"2025-10-15T12:30:00Z"

updated_at
string<date-time> | null

الطابع الزمني لآخر تحديث للاشتراك في نظامنا.

Example:

"2025-10-20T09:00:00Z"