Orders Data
This guide explains how to interact with the Orders API in the Sumaya369 web application. The API provides endpoints for retrieving and updating orders.
List Orders
Retrieve a list of orders for the authenticated customer. This endpoint returns the customer's orders with their associated products.
Endpoint
- Method: GET
- URL:
/v1/customer/orders
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer token | Yes |
Query Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| sort | string | Sort direction ('asc' or 'desc') | No |
| orderBy | string | Field to sort by (default: 'created_at') | No |
| per_page | integer | Number of items per page (default: 10) | No |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://127.0.0.1:8000/v1/customer/orders?page=1",
"from": 1,
"last_page": 13,
"last_page_url": "http://127.0.0.1:8000/v1/customer/orders?page=13",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://127.0.0.1:8000/v1/customer/orders?page=1",
"label": "1",
"active": true
},
{
"url": "http://127.0.0.1:8000/v1/customer/orders?page=2",
"label": "2",
"active": false
},
{
"url": "http://127.0.0.1:8000/v1/customer/orders?page=2",
"label": "التالي »",
"active": false
}
],
"next_page_url": "http://127.0.0.1:8000/v1/customer/orders?page=2",
"path": "http://127.0.0.1:8000/v1/customer/orders",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 121,
"orders": [
{
"id": "771a0ad0-c298-11ef-abb5-6ba38c7c7dbe",
"number": 2412194962,
"status": "free_order",
"payment_method": "paytabs_credit_card",
"products_count": 1,
"purchase_date": "2024-12-25",
"total_price": "546.30",
"total_discount": "546.30",
"total_price_after_discount": 0,
"tax": 0,
"amount_paid_with_wallet": "0",
"total_price_after_tax": "0.00",
"products": [
{
"id": "051dd0b0-b082-11ef-a315-f1dd5149d0a2",
"name": "باقة القفزة",
"course_name": null,
"type": "bundle",
"count": 4,
"poster": "http://127.0.0.1:8000/storage/27472/4--باقة-القفزة-(4مواد).jpg",
"old_price": "546.30",
"price": "0.00",
"certificate_price": 0,
"summary_price": 0,
"subtotal": "0.00",
"subtotal_after_tax": "0.00",
"duration": null,
"with_certificate": false,
"with_summary": false,
"gift_username": null,
"gift_email": null,
"meta": "{\"subscription_ids\":[\"0bc828b0-70f7-11ed-9d48-4b83edbe23fd\",\"774fff20-c298-11ef-8d84-276fab398449\",\"7de663a0-afc5-11ef-80b7-41ec775c4b05\",\"193de7c0-c1eb-11ef-89fe-51d8af9cf35c\"]}",
"gift_id": null,
"share_message_to_whats_app": null
}
],
"transfers": null,
"bank_transfer_source": "أخرى",
"can_re_pay": true
},
{
"id": "7d8348a0-afc5-11ef-918c-b51527577e44",
"number": 2412187991,
"status": "free_order",
"payment_method": "paytabs_credit_card",
"products_count": 1,
"purchase_date": "2024-12-01",
"total_price": "162.00",
"total_discount": "162.00",
"total_price_after_discount": 0,
"tax": 0,
"amount_paid_with_wallet": "0",
"total_price_after_tax": "0.00",
"products": [
{
"id": "70fa6b40-afbc-11ef-b4b2-e53d51e01e43",
"name": "تمرين Reframing الاستعداد",
"course_name": null,
"type": "course",
"count": 1,
"poster": "http://127.0.0.1:8000/storage/27412/12-الاستعداد.jpg",
"old_price": "162.00",
"price": "0.00",
"certificate_price": 0,
"summary_price": 0,
"subtotal": "0.00",
"subtotal_after_tax": "0.00",
"duration": 90,
"with_certificate": false,
"with_summary": false,
"gift_username": null,
"gift_email": null,
"meta": null,
"gift_id": null,
"share_message_to_whats_app": null
}
],
"transfers": null,
"bank_transfer_source": "أخرى",
"can_re_pay": true
},
]
},
"status_code": 200
}
Update Order
Update an existing order by adding transfer media files.
Endpoint
- Method: PUT
- URL:
/v1/customer/orders/{id}
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | multipart/form-data | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer token | Yes |
Request Body
| Parameter | Type | Description | Required |
|---|---|---|---|
| transfers[] | file | Transfer media files to be attached to the order | Yes |
Success Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": null,
"status_code": 200
}
Example Implementation Flow
-
List Orders
- Application sends authenticated GET request to
/v1/customer/orders - Optionally include sorting and pagination parameters
- Display list of orders with their associated products
- Show order status and payment information
- Application sends authenticated GET request to
-
Update Order
- User selects transfer files to upload
- Application sends multipart form request with files
- Handle success/error responses appropriately
Key Considerations
- Authentication is required for all order endpoints
- Orders are tied to the authenticated customer
- The list endpoint supports both web and mobile platforms with different response formats
- Transfer files are stored in the media collection for the order