Skip to main content

Subscriptions

This section covers the API endpoints for managing subscriptions in the admin panel. Subscriptions allow customers to access courses, bundles, and ebooks for specified durations.

List Subscriptions

Retrieve a paginated list of all subscriptions.

GET /v1/admin/subscriptions

Query Parameters

ParameterTypeDescription
filter[expired]booleanFilter by expired status
filter[customer_id]stringFilter by customer ID
filter[customer_email]stringFilter by customer email
filter[subscribable]stringFilter by subscribable (course, bundle, ebook)
filter[search_text]stringSearch in product name, customer name, email, or order number
per_pageintegerNumber of items per page (default: 10)
sortstringSort by field (expiry_date, customer, product_name)

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/subscriptions?page=1",
"from": 1,
"last_page": 43525,
"last_page_url": "http://192.168.0.139:8080/v1/admin/subscriptions?page=43525",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/subscriptions?page=1",
"label": "1",
"active": true
},
{
"url": "http://192.168.0.139:8080/v1/admin/subscriptions?page=2",
"label": "2",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/subscriptions?page=3",
"label": "3",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/subscriptions?page=2",
"label": "التالي »",
"active": false
}
],
"next_page_url": "http://192.168.0.139:8080/v1/admin/subscriptions?page=2",
"path": "http://192.168.0.139:8080/v1/admin/subscriptions",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 435243,
"subscriptions": [
{
"id": "572eb2c0-d260-11ef-8384-7f36cc3384ae",
"order_number": null,
"expired_date": "2027-01-14",
"product_poster": "http://192.168.0.139:8080/storage/28916/4--طاقة-الازمات.jpg",
"with_certificate": false,
"with_summary": false,
"customer_name": "فاطمة الحداد",
"customer_email": "zahraaalhaddad.2031@hotmail.com",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"expired": false,
"active": true,
"expiry_date": "2027-01-14 23:59:59",
"customer_id": "92ca2053-3a7b-4d58-9f27-ea9519a418f9",
"subscribable_id": "ed5d1a40-b67a-11ec-8630-a7dae8085a21",
"subscribable_type": "App\\Models\\Course",
"product_name": "طاقة الازمات"
},
{
"id": "422cd250-d260-11ef-abe6-130f1af13208",
"order_number": null,
"expired_date": "2027-01-14",
"product_poster": "http://192.168.0.139:8080/storage/18990/حالة-الطوارئ1.png",
"with_certificate": false,
"with_summary": false,
"customer_name": "فاطمة الحداد",
"customer_email": "zahraaalhaddad.2031@hotmail.com",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"expired": false,
"active": true,
"expiry_date": "2027-01-14 23:59:59",
"customer_id": "92ca2053-3a7b-4d58-9f27-ea9519a418f9",
"subscribable_id": "011299c0-7d54-11ee-a8be-9f865491810c",
"subscribable_type": "App\\Models\\Course",
"product_name": "حالة الطوارئ"
},
{
"id": "fbc81820-d25f-11ef-b116-bffd3e20291c",
"order_number": null,
"expired_date": "2027-01-14",
"product_poster": "http://192.168.0.139:8080/storage/11746/مافيا-الروحانية---مادة.png",
"with_certificate": false,
"with_summary": false,
"customer_name": "فاطمة الحداد",
"customer_email": "zahraaalhaddad.2031@hotmail.com",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"expired": false,
"active": true,
"expiry_date": "2027-01-14 23:59:59",
"customer_id": "92ca2053-3a7b-4d58-9f27-ea9519a418f9",
"subscribable_id": "6252e1b0-c6d5-11ed-b4b1-af24326941ff",
"subscribable_type": "App\\Models\\Course",
"product_name": "مافيا الروحانية"
},
{
"id": "d695d8e0-d25e-11ef-8d73-65fe1c2f48bc",
"order_number": 2501202562,
"expired_date": "2030-01-13",
"product_poster": "http://192.168.0.139:8080/storage/20785/بداية-القصه.png",
"with_certificate": false,
"with_summary": false,
"customer_name": "Lamya Alzeer",
"customer_email": "gldhxx@gmail.com",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"expired": false,
"active": true,
"expiry_date": "2030-01-13 23:59:59",
"customer_id": "871e0a50-4962-4736-8b95-26a97517322f",
"subscribable_id": "ee07cc50-868d-11ed-ac0d-db5a8dee23cb",
"subscribable_type": "App\\Models\\Course",
"product_name": "بداية القصة"
},
{
"id": "3266b550-d25d-11ef-a5fd-43df2219c4db",
"order_number": 2501202558,
"expired_date": "2029-07-13",
"product_poster": "http://192.168.0.139:8080/storage/28913/2--الثقة-بالنفس.jpg",
"with_certificate": false,
"with_summary": false,
"customer_name": "Dalia Beshir",
"customer_email": "dalita212@hotmail.com",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"expired": false,
"active": true,
"expiry_date": "2029-07-13 23:59:59",
"customer_id": "7d413d59-cc67-4a53-8416-f85286d3aa32",
"subscribable_id": "d32c6190-b67a-11ec-955e-b940e5a4bde1",
"subscribable_type": "App\\Models\\Course",
"product_name": "الثقة بالنفس - العار"
},
]
},
"status_code": 200
}

Get Subscription Statistics

Retrieve statistics about subscriptions.

GET /v1/admin/subscriptions/statistics

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"total_subscriptions": "1.5K",
"most_subscribed_products": [
{
"poster": "path/to/poster.jpg",
"name": "Product Name",
"subscriptions": "500"
}
],
"most_profitable_products": [
{
"name": "Product Name",
"profit": "50,000"
}
]
},
"status_code": 200
}

Show Subscription

Retrieve details of a specific subscription.

GET /v1/admin/subscriptions/{id}

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "572eb2c0-d260-11ef-8384-7f36cc3384ae",
"expiry_date": "2027-01-14 23:59:59",
"expired_date": "2027-01-14",
"customer_id": "92ca2053-3a7b-4d58-9f27-ea9519a418f9",
"product_name": "طاقة الازمات",
"product_poster": "http://192.168.0.139:8080/storage/28916/4--طاقة-الازمات.jpg",
"with_certificate": false,
"with_summary": false,
"customer_name": "فاطمة الحداد",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"customer_email": "zahraaalhaddad.2031@hotmail.com",
"customer_username": "zahraaalhaddad.2031",
"creator_name": "فاطمة الحداد",
"creator_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"creator_email": "zahraaalhaddad.2031@hotmail.com",
"creator_username": "zahraaalhaddad.2031",
"created_by": "اشتراك مجاني",
"status": true,
"active": true,
"order_id": null,
"is_expired": false,
"created_at": "2025-01-14 13:14:29",
"updated_at": "2025-01-14 13:14:29",
"activities_count": 0,
"subscription_records_count": 1
},
"status_code": 200
}

Update Subscription

Update an existing subscription.

PATCH /v1/admin/subscriptions/{id}

Request Body

ParameterTypeRequiredDescription
to_customer_emailstringNoEmail of the customer to transfer subscription to
expiry_datestringNo*New expiry date (format: Y-m-d)
unlimitedbooleanNo*Set to true for unlimited subscription
activebooleanNoSubscription status

*Either expiry_date or unlimited is required

Response

{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "572eb2c0-d260-11ef-8384-7f36cc3384ae",
"expiry_date": "2031-05-12T20:59:59.999999Z",
"expired_date": "2031-05-12",
"customer_id": "0cc381ef-2d50-441c-8ce5-6b6a3e52bedc",
"product_name": "طاقة الازمات",
"product_poster": "http://192.168.0.139:8080/storage/28916/4--طاقة-الازمات.jpg",
"with_certificate": false,
"with_summary": false,
"customer_name": "Noor Now",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"customer_email": "ladynmb@hotmail.com",
"customer_username": "noor.now",
"creator_name": "فاطمة الحداد",
"creator_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"creator_email": "zahraaalhaddad.2031@hotmail.com",
"creator_username": "zahraaalhaddad.2031",
"created_by": "اشتراك مجاني",
"status": true,
"active": true,
"order_id": null,
"is_expired": false,
"created_at": "2025-01-14 13:14:29",
"updated_at": "2025-03-20 19:40:27",
"activities_count": 1,
"subscription_records_count": 3
},
"status_code": 200
}

Bulk Update Subscriptions

Update multiple subscriptions at once.

PATCH /v1/admin/subscriptions

Request Body

ParameterTypeRequiredDescription
idsarrayYesArray of subscription UUIDs
ids.*stringYesSubscription UUID
to_customer_emailstringNoEmail of the customer to transfer subscriptions to
expiry_datestringNoNew expiry date (format: Y-m-d)
activebooleanNoSubscription status

Response

{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": null,
"status_code": 200
}

Notes

  • When transferring a subscription to another customer using to_customer_email, if the target customer already has an active subscription for the same product, the old subscription will be deleted.
  • When setting unlimited to true, the expiry_date will be set to null.
  • The ids parameter in bulk update must not include subscriptions that would create duplicate active subscriptions for the same customer and product.