Cart
These endpoints allow you to retrieve the current cart items and related information for both authenticated users and visitors.
Authenticated User Cart Index
POST /v1/customer/cart
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"cart_items": [
{
"id": "09d53ec0-b305-11ef-98a6-735d2de688a2",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/23410/%D8%A7%D9%84%D8%B3%D9%84%D8%A9.png",
"name": "الباقه الباقه",
"course_name": null,
"price": 250,
"price_after_tax": 287.5,
"type": "bundle",
"count": 3,
"has_active_subscribed": false,
"added_by_special_id": false,
"duration": null,
"old_price": "250.00",
"has_certificate": false,
"certificate_price": 0,
"has_summary": false,
"summary_price": 0,
"in_bundle": null,
"bundle_id": null,
"meta": null,
"gift": null
},
{
"id": "1ab0a790-6f1b-11ed-b447-6d37ecfb06a6",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/6017/%D8%AD%D9%85%D8%A7%D9%8A%D8%A9-%D8%A7%D9%84%D8%B0%D8%A7%D8%AA.png",
"name": "حماية الذات",
"course_name": null,
"price": 190.44,
"price_after_tax": 219.01,
"type": "course",
"count": 5,
"has_active_subscribed": false,
"added_by_special_id": false,
"duration": 730,
"old_price": null,
"has_certificate": false,
"certificate_price": 0,
"has_summary": false,
"summary_price": 0,
"in_bundle": true,
"bundle_id": "09d53ec0-b305-11ef-98a6-735d2de688a2",
"meta": null,
"gift": null
},
{
"id": "0f35b180-b67b-11ec-913b-27291b8dcad2",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/21265/2--%D9%82%D8%A7%D9%86%D9%88%D9%86-%D8%A7%D9%84%D9%85%D8%B3%D8%A4%D9%88%D9%84%D9%8A%D8%A9.png",
"name": "قانون المسؤولية",
"course_name": null,
"price": 95.22,
"price_after_tax": 109.5,
"type": "course",
"count": 15,
"has_active_subscribed": false,
"added_by_special_id": false,
"duration": 730,
"old_price": 190.44,
"has_certificate": false,
"certificate_price": 0,
"has_summary": false,
"summary_price": 0,
"in_bundle": true,
"bundle_id": "fbcc8770-b2fd-11ef-ae03-c7976df74273",
"meta": null,
"gift": null
}
],
"discounts": [
{
"amount": "100.00",
"code": "ITdept",
"method": "percentage"
}
],
"related_products": []
},
"status_code": 200
}
Visitor Cart Index
POST /v1/visitor-cart
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| products | array | Yes | Array of products to be processed |
| products.*.id | boolean | No | The product's ID |
| products.*.type | boolean | No | The product |
Response Example
Similar to authenticated user response, but with following differences:
- No discounts array
- No related products array
- Limited product information
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"cart_items": [
{
"id": "d0783b40-b67a-11ec-9e13-e789e2016520",
"poster": "https://sumaya369-testing-media.s3.us-east-2.amazonaws.com/608/%D8%A7%D9%84%D8%AD%D8%B2%D9%86-%D8%AC%D8%AF%D9%8A%D8%AF-%D9%85%D9%88%D9%82%D8%B9.png",
"name": "الحزن",
"course_name": null,
"price": 240,
"price_after_tax": 276,
"type": "course",
"count": 15,
"has_active_subscribed": false,
"added_by_special_id": false,
"duration": 730,
"old_price": null,
"has_certificate": true,
"certificate_price": 0,
"has_summary": false,
"summary_price": 0,
"in_bundle": true,
"bundle_id": "2af497e0-ba19-11ec-960a-093aa65c415e",
"meta": null,
"gift": null
}
],
"discounts": [],
"related_products": []
},
"status_code": 200
}
Implementation Details
Flow
- Validates the incoming request parameters
- For authenticated users:
- Creates cart collection from products array
- Generates related products
- Retrieves available discounts
- For visitors:
- Creates visitor cart collection
- No discounts or related products
- Generates product collection with basic pricing
- Returns formatted response with cart items and additional data
Special Cases
- Videos from the same course are grouped together
- Product types are differentiated in the response
- Gift-related information is included when applicable
Error Responses
{
"status": false,
"message": "Error message",
"data": null
}
Notes
- This endpoint focuses on retrieving cart data without payment processing
- Authenticated users get additional features like discounts and related products
- Mobile platform responses may include additional fields for bundle and course counts