Skip to main content

Subscriptions

This guide explains how to interact with the Subscriptions API in the Sumaya369 web application. The API provides endpoints for retrieving and creating subscriptions.

List Subscriptions

Retrieve a list of subscriptions for the authenticated customer. This endpoint returns the customer's active and historical subscriptions, filtered by product type.

Endpoint

  • Method: GET
  • URL: /v1/customer/subscriptions

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Query Parameters

ParameterTypeDescriptionRequired
typestringFilter by product type ('courses', 'ebooks', 'bundles')Yes
search_textstringSearch within product namesNo
per_pageintegerNumber of items per pageNo

Success Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=1",
"from": 1,
"last_page": 12,
"last_page_url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=12",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=1",
"label": "1",
"active": true
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=2",
"label": "2",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=3",
"label": "3",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=4",
"label": "4",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=5",
"label": "5",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=6",
"label": "6",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=7",
"label": "7",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=8",
"label": "8",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=9",
"label": "9",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=10",
"label": "10",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=11",
"label": "11",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=12",
"label": "12",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=2",
"label": "التالي »",
"active": false
}
],
"next_page_url": "http://testing-api.sumaya369.net/v1/customer/subscriptions?type=courses&page=2",
"path": "http://testing-api.sumaya369.net/v1/customer/subscriptions",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 117,
"subscriptions": [
{
"id": "cdf6d630-074d-11ef-abe7-ddadec691381",
"slug": "dce-تطوير-الجسد-المشاعري-للاطفال",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/22681/%D8%AC%D8%AF%D9%8A%D8%AF-%D9%85%D8%A7%D8%AF%D8%A9-%D8%A7%D9%84%D8%AC%D8%B3%D8%AF-%D8%A7%D9%84%D9%85%D8%B4%D8%A7%D8%B9%D8%B1%D9%8A-%D9%84%D9%84%D8%B7%D9%81%D9%84-min.jpg",
"name": "DCE تطوير الجسد المشاعري للاطفال",
"price": 965,
"model_type": "courses",
"course_description": "...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 452 يوم",
"expiry_date": "2026-05-24 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 13,
"active": true
},
{
"id": "0d2ad510-0751-11ef-bfbe-3d02899e4a37",
"slug": "حوار-المشاعر",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/22680/%D8%AC%D8%AF%D9%8A%D8%AF-%D9%85%D8%A7%D8%AF%D8%A9-%D8%AD%D9%88%D8%A7%D8%B1-%D8%A7%D9%84%D9%85%D8%B4%D8%A7%D8%B9%D8%B1-min.jpg",
"name": "حوار المشاعر",
"price": 965,
"model_type": "courses",
"course_description": "...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 435 يوم",
"expiry_date": "2026-05-07 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 12,
"active": true
},
{
"id": "16b38b60-0e91-11ee-bf6c-e7998f321459",
"slug": "الجارية-vs-السيدة",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/14575/%D8%A7%D9%84%D8%AC%D8%A7%D8%B1%D9%8A%D8%A9.png",
"name": "الجارية VS السيدة",
"price": 490.44,
"model_type": "courses",
"course_description": " ...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 12,
"active": true
},
{
"id": "e23606b0-0e90-11ee-bf38-259ab53ebaf2",
"slug": "اسرار-الانوثة",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/14385/%D8%A3%D8%B3%D8%B1%D8%A7%D8%B1-%D8%A7%D9%84%D8%A3%D9%86%D9%88%D8%AB%D8%A9.png",
"name": "اسرار الانوثة",
"price": 190.44,
"model_type": "courses",
"course_description": "...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 4,
"active": true
},
{
"id": "8c10b320-c6d5-11ed-8429-d53af78897cb",
"slug": "مواقيت-الروح",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/21602/1--%D9%85%D9%88%D8%A7%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B1%D9%88%D8%AD_%D9%85%D9%82%D8%A7%D8%B3-%D8%A7%D9%84%D9%85%D9%88%D9%82%D8%B9-min.png",
"name": "مواقيت الروح",
"price": 180,
"model_type": "courses",
"course_description": "...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 1,
"active": true
},
{
"id": "1c2f2790-b67b-11ec-b199-674535ca9ad6",
"slug": "رمضان-ريكونكـت",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/21605/2--%D8%B1%D9%85%D8%B6%D8%A7%D9%86-%D8%B1%D9%8A%D9%83%D9%88%D9%86%D9%83%D8%AA_%D9%85%D9%82%D8%A7%D8%B3-%D8%A7%D9%84%D9%85%D9%88%D9%82%D8%B9-min.png",
"name": "رمضان ريكونكـت",
"price": 75.65,
"model_type": "courses",
"course_description": " ...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 21,
"active": true
},
{
"id": "1b7dfa10-b67b-11ec-9e9b-950a8670750d",
"slug": "الصيـام",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/21860/14--%D8%A7%D9%84%D8%B5%D9%8A%D8%A7%D9%85-min.png",
"name": "الصيـام",
"price": 500,
"model_type": "courses",
"course_description": " ...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 26,
"active": true
},
{
"id": "28e2fc20-c6d5-11ed-8351-b7f955b8fb1a",
"slug": "الجوع-الروحي",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/21603/5--%D8%A7%D9%84%D8%AC%D9%88%D8%B9-%D8%A7%D9%84%D8%B1%D9%88%D8%AD%D9%8A_%D9%85%D9%82%D8%A7%D8%B3-%D8%A7%D9%84%D9%85%D9%88%D9%82%D8%B9-min.png",
"name": "الجوع الروحي",
"price": 290.44,
"model_type": "courses",
"course_description": "...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 6,
"active": true
},
{
"id": "1e753f60-b67b-11ec-81fa-3981a3ae7be5",
"slug": "قصة-الروح",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/21620/10--%D9%82%D8%B5%D8%A9-%D8%A7%D9%84%D8%B1%D9%88%D8%AD-min.png",
"name": "قصة الروح",
"price": 360.9,
"model_type": "courses",
"course_description": " ...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 16,
"active": true
},
{
"id": "1cdc8460-b67b-11ec-9f0a-6f47d6ae0df4",
"slug": "اسرة-الروح",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/21692/8--%D8%A7%D8%B3%D8%B1%D8%A9-%D8%A7%D9%84%D8%B1%D9%88%D8%AD-%281%29-%281%29.png",
"name": "اسرة الروح",
"price": 90.44,
"model_type": "courses",
"course_description": "...",
"watched_videos_count": 0,
"subscription_status_date": "سينتهي اشتراكك بعد 119 يوم",
"expiry_date": "2025-06-25 23:59:59",
"with_summary": false,
"with_certificate": false,
"can_resubscribe": false,
"videos_count": 1,
"active": true
}
]
},
"status_code": 200
}

Create Subscription

Create a new subscription for the authenticated customer. This endpoint handles both free courses and courses with reduced pricing.

Endpoint

  • Method: POST
  • URL: /v1/customer/subscriptions

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Request Body

ParameterTypeDescriptionRequired
idstringUUID or special ID of the courseYes

Success Response

{
"success": true,
"message": "تم إضافة المادة إلى إشتراكاتك",
"data": null,
"status_code": 200
}

Error Responses

{
"success": false,
"message": "أنت مشترك في هذه المادة من قبل",
"errors": "أنت مشترك في هذه المادة من قبل",
"data": null,
"status_code": 400
}
{
"success": false,
"message": "أنت غير مصرح لهذا الإجراء",
"errors": "أنت غير مصرح لهذا الإجراء",
"data": null,
"status_code": 422
}

Implementation Details

Listing Subscriptions

  • Supports filtering by product type (courses, ebooks, bundles)
  • Courses are sorted by completion status and expiry date
  • Bundle subscriptions show grouped products under each bundle
  • Includes video progress tracking for courses
  • Supports pagination and search functionality

Creating Subscriptions

  • Handles both UUID and special course IDs
  • Validates free course access
  • Checks for reduced price eligibility
  • Manages subscription renewal for existing subscriptions
  • Sets appropriate expiration dates based on course duration
  • Records subscription history and operations

Key Considerations

  • Authentication is required for all subscription endpoints
  • Subscriptions are tied to the authenticated customer
  • Course subscriptions include video tracking and certificate/summary availability
  • Bundle subscriptions group related products together
  • Proper validation is performed for subscription eligibility