Skip to main content

Orders

This section covers all the available endpoints for managing orders.

Available Endpoints

List Orders

Get a list of all orders for the authenticated customer.

Endpoint

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

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Query Parameters

ParameterTypeDescriptionRequiredDefault
per_pageintegerNumber of items per pageNo5

Success Response

{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": {
"orders": [
{
"id": "uuid",
"number": 2503001328,
"total": "2500.00",
"subtotal": "2500.00",
"totalTax": "0.00",
"totalDiscount": "0.00",
"createdAt": "2025/03/23 13:58",
"paymentMethod": "المحفظة",
"status": "مكتمل",
"showDetails": false,
"coachName": "احمد البيتي",
"sessionType": "مجدولة",
"sessionDuration": 60,
"sessionStartsAt": "13:00",
"sessionCategory": "استشارة طبية"
}
],
"current_page": 1,
"from": 1,
"last_page": 1,
"per_page": 5,
"to": 1,
"total": 1
},
"statusCode": 200
}

Error Response

Unauthorized (401)
{
"success": false,
"message": "غير مصرح",
"data": null,
"statusCode": 401
}

Get Order Details

Get detailed information about a specific order.

Endpoint

  • Method: GET
  • URL: /v1/customer/orders/{id}

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Path Parameters

ParameterTypeDescriptionRequired
idstringOrder IDYes

Success Response

{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": {
"id": "uuid",
"number": "230100001",
"customer_id": "uuid",
"discount_id": "uuid",
"coupon": "string",
"payment_method": "string",
"status": "string",
"subtotal": "decimal",
"total_tax": "decimal",
"total_discount": "decimal",
"total": "decimal",
"payment_reference_id": "string",
"created_at": "datetime",
},
"statusCode": 200
}

Error Response

Order Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الطلب",
"data": null,
"statusCode": 404
}
Unauthorized (401)
{
"success": false,
"message": "غير مصرح",
"data": null,
"statusCode": 401
}

Get Order Calendar Data

Get calendar information for a specific order's session.

Endpoint

  • Method: GET
  • URL: /v1/customer/order-calender-data/{orderId}

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Path Parameters

ParameterTypeDescriptionRequired
idstringOrder IDYes

Success Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "uuid",
"start": "2025-03-25T10:00:00.000000Z",
"end": "2025-03-25T10:00:00.000000Z",
"description": "assas",
"customerName": "ماريا المجالي",
"coachName": "احمد البيتي"
},
"statusCode": 200
}

Error Response

Order Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الطلب",
"data": null,
"statusCode": 404
}
Session Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الجلسة",
"data": null,
"statusCode": 404
}
Unauthorized (401)
{
"success": false,
"message": "غير مصرح",
"data": null,
"statusCode": 401
}

Postpone Session

Request to postpone a session in an order.

Endpoint

  • Method: POST
  • URL: /v1/customer/orders/postpone-session

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Request Body

ParameterTypeDescriptionRequired
order_idstringOrder IDYes
session_idstringSession ID to postponeYes
postpone_datestringNew date for the session (format: Y-m-d)Yes
postpone_timestringNew time for the session (format: H:i)Yes
postpone_reasonstringReason for postponing the sessionYes

Success Response

{
"success": true,
"message": "تم طلب تأجيل الجلسة بنجاح",
"data": {
"id": "uuid",
"order_id": "uuid",
"session_id": "uuid",
"postpone_date": "2025-03-25",
"postpone_time": "10:00",
"postpone_reason": "string",
"status": "pending",
"created_at": "datetime"
},
"statusCode": 200
}

Error Response

Order Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الطلب",
"data": null,
"statusCode": 404
}
Session Not Found (404)
{
"success": false,
"message": "لم يتم العثور على الجلسة",
"data": null,
"statusCode": 404
}
Invalid Session Status (422)
{
"success": false,
"message": "لا يمكن تأجيل الجلسة في هذا الحالة",
"data": null,
"statusCode": 422
}
Unauthorized (401)
{
"success": false,
"message": "غير مصرح",
"data": null,
"statusCode": 401
}

Accept Postpone Session

Accept a session postponement request.

Endpoint

  • Method: POST
  • URL: /v1/customer/orders/accept-postpone-session/{id}

Request Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer tokenYes

Path Parameters

ParameterTypeDescriptionRequired
idstringPostpone Session Request IDYes

Success Response

{
"success": true,
"message": "تم قبول طلب تأجيل الجلسة بنجاح",
"data": {
"id": "uuid",
"order_id": "uuid",
"session_id": "uuid",
"postpone_date": "2025-03-25",
"postpone_time": "10:00",
"postpone_reason": "string",
"status": "accepted",
"created_at": "datetime",
"updated_at": "datetime"
},
"statusCode": 200
}

Error Response

Postpone Request Not Found (404)
{
"success": false,
"message": "لم يتم العثور على طلب التأجيل",
"data": null,
"statusCode": 404
}
Invalid Request Status (422)
{
"success": false,
"message": "لا يمكن قبول طلب التأجيل في هذا الحالة",
"data": null,
"statusCode": 422
}
Unauthorized (401)
{
"success": false,
"message": "غير مصرح",
"data": null,
"statusCode": 401
}

Overview

Order Statuses

  • PENDING_PAYMENT: Order is created but payment is pending
  • PROCESSING: Payment is being processed
  • COMPLETED: Order has been paid and completed
  • CANCELLED: Order has been cancelled
  • FAILED: Payment processing failed

Payment Methods

  • CREDIT_CARD: Payment via credit card
  • WALLET: Payment using wallet balance
  • APPLE_PAY: Payment via Apple Pay

General Information

  • All orders are assigned a unique order number
  • Orders are associated with one or more sessions
  • Each order includes complete financial details
  • Orders can include discounts and coupons
  • Payment information is securely processed

Order Management

  • Orders can be filtered by various criteria
  • Order status can be tracked throughout the process
  • Orders include detailed session information
  • Each order is linked to a specific customer
  • Orders maintain payment reference information

Financial Details

  • Orders include subtotal, tax, and discount calculations
  • Total amount reflects all applicable charges
  • Discounts can be applied at order level
  • Payment methods are supported based on availability
  • Financial records are maintained for each order

Security and Access

  • Orders are only accessible to the associated customer
  • Payment information is encrypted and secure
  • Order details are protected by authentication
  • Access is controlled through authorization
  • Sensitive information is properly handled

Integration with Sessions

  • Orders can contain multiple sessions
  • Session details are included in order information
  • Each session links to specific coach and category
  • Session timing is tracked within orders
  • Order status affects session availability

Calendar Integration

  • Orders provide calendar-specific data
  • Session timing is formatted for calendar display
  • Start and end times are included
  • Coach information is available for calendar events
  • Calendar data includes all necessary session details