Complete E-commerce API

Full-featured e-commerce API with auth, products, orders, payments, reviews, shipping

9
Resources
2025-11-28
2 days ago

Addresses

User delivery addresses - user-specific

GET /api/ecommerce/addresses Auth Required User Filtering

Retrieve a paginated list of all addresses

Returns only addresses belonging to authenticated user
Request Example
GET /api/ecommerce/addresses
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "user_id": 1,
        "user_name": "John Anderson",
        "label": "Home",
        "street_address": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001",
        "lat": 40.7588999999999970214048516936600208282470703125,
        "lng": -73.9851000000000027512214728631079196929931640625,
        "is_default": true
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/addresses/{id} Auth Required

Retrieve a single addresse by ID

Request Example
GET /api/ecommerce/addresses/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
    "user_id": 1,
    "user_name": "John Anderson",
    "label": "Home",
    "street_address": "123 Main Street, Apt 4B",
    "city": "New York",
    "state": "NY",
    "country": "USA",
    "postal_code": "10001",
    "lat": 40.7588999999999970214048516936600208282470703125,
    "lng": -73.9851000000000027512214728631079196929931640625,
    "is_default": true
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested addresse does not exist"
}
POST /api/ecommerce/addresses Auth Required Auto User ID

Create a new addresse

Request Body
POST /api/ecommerce/addresses
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "user_id": 1,
    "user_name": "John Anderson",
    "label": "Home",
    "street_address": "123 Main Street, Apt 4B",
    "city": "New York",
    "state": "NY",
    "country": "USA",
    "postal_code": "10001",
    "lat": 40.7588999999999970214048516936600208282470703125,
    "lng": -73.9851000000000027512214728631079196929931640625,
    "is_default": true
}
Response Example 201 Created
{
    "user_id": 1,
    "user_name": "John Anderson",
    "label": "Home",
    "street_address": "123 Main Street, Apt 4B",
    "city": "New York",
    "state": "NY",
    "country": "USA",
    "postal_code": "10001",
    "lat": 40.7588999999999970214048516936600208282470703125,
    "lng": -73.9851000000000027512214728631079196929931640625,
    "is_default": true
}
PUT/PATCH /api/ecommerce/addresses/{id} Auth Required Ownership Check

Update an existing addresse

Only the owner can update this resource
Request Body
PUT /api/ecommerce/addresses/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "user_id": 1,
    "user_name": "John Anderson",
    "label": "Home",
    "street_address": "123 Main Street, Apt 4B",
    "city": "New York",
    "state": "NY",
    "country": "USA",
    "postal_code": "10001",
    "lat": 40.7588999999999970214048516936600208282470703125,
    "lng": -73.9851000000000027512214728631079196929931640625,
    "is_default": true
}
Response Example 200 OK
{
    "user_id": 1,
    "user_name": "John Anderson",
    "label": "Home",
    "street_address": "123 Main Street, Apt 4B",
    "city": "New York",
    "state": "NY",
    "country": "USA",
    "postal_code": "10001",
    "lat": 40.7588999999999970214048516936600208282470703125,
    "lng": -73.9851000000000027512214728631079196929931640625,
    "is_default": true
}
DELETE /api/ecommerce/addresses/{id} Auth Required Ownership Check

Delete a addresse by ID

Only the owner can delete this resource
Request Example
DELETE /api/ecommerce/addresses/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Addresse deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Categories

Product categories

GET /api/ecommerce/categories Public

Retrieve a paginated list of all categories

Request Example
GET /api/ecommerce/categories
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "name": "Electronics",
        "slug": "electronics",
        "description": "Electronic devices and accessories",
        "image": "https://picsum.photos/300/300?random=cat1",
        "parent_id": null,
        "products_count": 15
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/categories/{id} Public

Retrieve a single categorie by ID

Request Example
GET /api/ecommerce/categories/1
Accept: application/json
Response Example 200 OK
{
    "name": "Electronics",
    "slug": "electronics",
    "description": "Electronic devices and accessories",
    "image": "https://picsum.photos/300/300?random=cat1",
    "parent_id": null,
    "products_count": 15
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested categorie does not exist"
}
POST /api/ecommerce/categories Auth Required

Create a new categorie

Request Body
POST /api/ecommerce/categories
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "Electronics",
    "slug": "electronics",
    "description": "Electronic devices and accessories",
    "image": "https://picsum.photos/300/300?random=cat1",
    "parent_id": null,
    "products_count": 15
}
Response Example 201 Created
{
    "name": "Electronics",
    "slug": "electronics",
    "description": "Electronic devices and accessories",
    "image": "https://picsum.photos/300/300?random=cat1",
    "parent_id": null,
    "products_count": 15
}
PUT/PATCH /api/ecommerce/categories/{id} Auth Required

Update an existing categorie

Request Body
PUT /api/ecommerce/categories/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "Electronics",
    "slug": "electronics",
    "description": "Electronic devices and accessories",
    "image": "https://picsum.photos/300/300?random=cat1",
    "parent_id": null,
    "products_count": 15
}
Response Example 200 OK
{
    "name": "Electronics",
    "slug": "electronics",
    "description": "Electronic devices and accessories",
    "image": "https://picsum.photos/300/300?random=cat1",
    "parent_id": null,
    "products_count": 15
}
DELETE /api/ecommerce/categories/{id} Auth Required

Delete a categorie by ID

Request Example
DELETE /api/ecommerce/categories/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Categorie deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Invoices

Order invoices - user-specific

GET /api/ecommerce/invoices Auth Required User Filtering

Retrieve a paginated list of all invoices

Returns only invoices belonging to authenticated user
Request Example
GET /api/ecommerce/invoices
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "invoice_number": "INV-2024-00001",
        "order_id": 1,
        "order_number": "ORD-2024-00001",
        "user_id": 1,
        "user_name": "John Anderson",
        "billing_address": {
            "name": "John Anderson",
            "street": "123 Main Street, Apt 4B",
            "city": "New York",
            "state": "NY",
            "country": "USA",
            "postal_code": "10001"
        },
        "items": [
            {
                "name": "MacBook Pro 16\"",
                "quantity": 1,
                "price": 2299.989999999999781721271574497222900390625,
                "total": 2299.989999999999781721271574497222900390625
            },
            {
                "name": "AirPods Pro (2nd Gen)",
                "quantity": 1,
                "price": 249.990000000000009094947017729282379150390625,
                "total": 249.990000000000009094947017729282379150390625
            }
        ],
        "subtotal": 2549.98000000000001818989403545856475830078125,
        "tax": 204,
        "total": 2769.96999999999979991116560995578765869140625,
        "status": "paid",
        "issued_at": "2024-01-15T10:30:00Z",
        "due_at": "2024-01-30T23:59:59Z",
        "paid_at": "2024-01-15T10:35:00Z"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/invoices/{id} Auth Required

Retrieve a single invoice by ID

Request Example
GET /api/ecommerce/invoices/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
    "invoice_number": "INV-2024-00001",
    "order_id": 1,
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "billing_address": {
        "name": "John Anderson",
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625,
            "total": 2299.989999999999781721271574497222900390625
        },
        {
            "name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625,
            "total": 249.990000000000009094947017729282379150390625
        }
    ],
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "total": 2769.96999999999979991116560995578765869140625,
    "status": "paid",
    "issued_at": "2024-01-15T10:30:00Z",
    "due_at": "2024-01-30T23:59:59Z",
    "paid_at": "2024-01-15T10:35:00Z"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested invoice does not exist"
}
POST /api/ecommerce/invoices Public

Create a new invoice

Request Body
POST /api/ecommerce/invoices
Content-Type: application/json

{
    "invoice_number": "INV-2024-00001",
    "order_id": 1,
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "billing_address": {
        "name": "John Anderson",
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625,
            "total": 2299.989999999999781721271574497222900390625
        },
        {
            "name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625,
            "total": 249.990000000000009094947017729282379150390625
        }
    ],
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "total": 2769.96999999999979991116560995578765869140625,
    "status": "paid",
    "issued_at": "2024-01-15T10:30:00Z",
    "due_at": "2024-01-30T23:59:59Z",
    "paid_at": "2024-01-15T10:35:00Z"
}
Response Example 201 Created
{
    "invoice_number": "INV-2024-00001",
    "order_id": 1,
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "billing_address": {
        "name": "John Anderson",
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625,
            "total": 2299.989999999999781721271574497222900390625
        },
        {
            "name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625,
            "total": 249.990000000000009094947017729282379150390625
        }
    ],
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "total": 2769.96999999999979991116560995578765869140625,
    "status": "paid",
    "issued_at": "2024-01-15T10:30:00Z",
    "due_at": "2024-01-30T23:59:59Z",
    "paid_at": "2024-01-15T10:35:00Z"
}
PUT/PATCH /api/ecommerce/invoices/{id} Public

Update an existing invoice

Request Body
PUT /api/ecommerce/invoices/1
Content-Type: application/json

{
    "invoice_number": "INV-2024-00001",
    "order_id": 1,
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "billing_address": {
        "name": "John Anderson",
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625,
            "total": 2299.989999999999781721271574497222900390625
        },
        {
            "name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625,
            "total": 249.990000000000009094947017729282379150390625
        }
    ],
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "total": 2769.96999999999979991116560995578765869140625,
    "status": "paid",
    "issued_at": "2024-01-15T10:30:00Z",
    "due_at": "2024-01-30T23:59:59Z",
    "paid_at": "2024-01-15T10:35:00Z"
}
Response Example 200 OK
{
    "invoice_number": "INV-2024-00001",
    "order_id": 1,
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "billing_address": {
        "name": "John Anderson",
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625,
            "total": 2299.989999999999781721271574497222900390625
        },
        {
            "name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625,
            "total": 249.990000000000009094947017729282379150390625
        }
    ],
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "total": 2769.96999999999979991116560995578765869140625,
    "status": "paid",
    "issued_at": "2024-01-15T10:30:00Z",
    "due_at": "2024-01-30T23:59:59Z",
    "paid_at": "2024-01-15T10:35:00Z"
}
DELETE /api/ecommerce/invoices/{id} Public

Delete a invoice by ID

Request Example
DELETE /api/ecommerce/invoices/1
Accept: application/json
Response Example 200 OK
{
  "message": "Invoice deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Orders

Customer orders - user-specific

GET /api/ecommerce/orders Auth Required User Filtering

Retrieve a paginated list of all orders

Returns only orders belonging to authenticated user
Request Example
GET /api/ecommerce/orders
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "order_number": "ORD-2024-00001",
        "user_id": 1,
        "user_name": "John Anderson",
        "status": "delivered",
        "subtotal": 2549.98000000000001818989403545856475830078125,
        "tax": 204,
        "shipping_cost": 15.9900000000000002131628207280300557613372802734375,
        "total": 2769.96999999999979991116560995578765869140625,
        "payment_method": "Credit Card (**** 4242)",
        "shipping_method": "Express Shipping",
        "shipping_address": {
            "street": "123 Main Street, Apt 4B",
            "city": "New York",
            "state": "NY",
            "country": "USA",
            "postal_code": "10001"
        },
        "items": [
            {
                "product_id": 1,
                "product_name": "MacBook Pro 16\"",
                "quantity": 1,
                "price": 2299.989999999999781721271574497222900390625
            },
            {
                "product_id": 5,
                "product_name": "AirPods Pro (2nd Gen)",
                "quantity": 1,
                "price": 249.990000000000009094947017729282379150390625
            }
        ],
        "created_at": "2024-01-15T10:30:00Z",
        "estimated_delivery": "2024-01-20"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/orders/{id} Auth Required

Retrieve a single order by ID

Request Example
GET /api/ecommerce/orders/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "status": "delivered",
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "shipping_cost": 15.9900000000000002131628207280300557613372802734375,
    "total": 2769.96999999999979991116560995578765869140625,
    "payment_method": "Credit Card (**** 4242)",
    "shipping_method": "Express Shipping",
    "shipping_address": {
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "product_id": 1,
            "product_name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625
        },
        {
            "product_id": 5,
            "product_name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625
        }
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "estimated_delivery": "2024-01-20"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested order does not exist"
}
POST /api/ecommerce/orders Auth Required Auto User ID

Create a new order

Request Body
POST /api/ecommerce/orders
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "status": "delivered",
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "shipping_cost": 15.9900000000000002131628207280300557613372802734375,
    "total": 2769.96999999999979991116560995578765869140625,
    "payment_method": "Credit Card (**** 4242)",
    "shipping_method": "Express Shipping",
    "shipping_address": {
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "product_id": 1,
            "product_name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625
        },
        {
            "product_id": 5,
            "product_name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625
        }
    ],
    "estimated_delivery": "2024-01-20"
}
Response Example 201 Created
{
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "status": "delivered",
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "shipping_cost": 15.9900000000000002131628207280300557613372802734375,
    "total": 2769.96999999999979991116560995578765869140625,
    "payment_method": "Credit Card (**** 4242)",
    "shipping_method": "Express Shipping",
    "shipping_address": {
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "product_id": 1,
            "product_name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625
        },
        {
            "product_id": 5,
            "product_name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625
        }
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "estimated_delivery": "2024-01-20"
}
PUT/PATCH /api/ecommerce/orders/{id} Auth Required Ownership Check

Update an existing order

Only the owner can update this resource
Request Body
PUT /api/ecommerce/orders/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "status": "delivered",
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "shipping_cost": 15.9900000000000002131628207280300557613372802734375,
    "total": 2769.96999999999979991116560995578765869140625,
    "payment_method": "Credit Card (**** 4242)",
    "shipping_method": "Express Shipping",
    "shipping_address": {
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "product_id": 1,
            "product_name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625
        },
        {
            "product_id": 5,
            "product_name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625
        }
    ],
    "estimated_delivery": "2024-01-20"
}
Response Example 200 OK
{
    "order_number": "ORD-2024-00001",
    "user_id": 1,
    "user_name": "John Anderson",
    "status": "delivered",
    "subtotal": 2549.98000000000001818989403545856475830078125,
    "tax": 204,
    "shipping_cost": 15.9900000000000002131628207280300557613372802734375,
    "total": 2769.96999999999979991116560995578765869140625,
    "payment_method": "Credit Card (**** 4242)",
    "shipping_method": "Express Shipping",
    "shipping_address": {
        "street": "123 Main Street, Apt 4B",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
    },
    "items": [
        {
            "product_id": 1,
            "product_name": "MacBook Pro 16\"",
            "quantity": 1,
            "price": 2299.989999999999781721271574497222900390625
        },
        {
            "product_id": 5,
            "product_name": "AirPods Pro (2nd Gen)",
            "quantity": 1,
            "price": 249.990000000000009094947017729282379150390625
        }
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "estimated_delivery": "2024-01-20"
}
DELETE /api/ecommerce/orders/{id} Auth Required Ownership Check

Delete a order by ID

Only the owner can delete this resource
Request Example
DELETE /api/ecommerce/orders/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Order deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Payment-methods

Available payment methods

GET /api/ecommerce/payment-methods Public

Retrieve a paginated list of all payment-methods

Request Example
GET /api/ecommerce/payment-methods
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "name": "Credit Card",
        "type": "card",
        "icon": "\ud83d\udcb3",
        "is_active": true,
        "description": "Visa, Mastercard, Amex"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/payment-methods/{id} Public

Retrieve a single payment-method by ID

Request Example
GET /api/ecommerce/payment-methods/1
Accept: application/json
Response Example 200 OK
{
    "name": "Credit Card",
    "type": "card",
    "icon": "\ud83d\udcb3",
    "is_active": true,
    "description": "Visa, Mastercard, Amex"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested payment-method does not exist"
}
POST /api/ecommerce/payment-methods Public

Create a new payment-method

Request Body
POST /api/ecommerce/payment-methods
Content-Type: application/json

{
    "name": "Credit Card",
    "type": "card",
    "icon": "\ud83d\udcb3",
    "is_active": true,
    "description": "Visa, Mastercard, Amex"
}
Response Example 201 Created
{
    "name": "Credit Card",
    "type": "card",
    "icon": "\ud83d\udcb3",
    "is_active": true,
    "description": "Visa, Mastercard, Amex"
}
PUT/PATCH /api/ecommerce/payment-methods/{id} Public

Update an existing payment-method

Request Body
PUT /api/ecommerce/payment-methods/1
Content-Type: application/json

{
    "name": "Credit Card",
    "type": "card",
    "icon": "\ud83d\udcb3",
    "is_active": true,
    "description": "Visa, Mastercard, Amex"
}
Response Example 200 OK
{
    "name": "Credit Card",
    "type": "card",
    "icon": "\ud83d\udcb3",
    "is_active": true,
    "description": "Visa, Mastercard, Amex"
}
DELETE /api/ecommerce/payment-methods/{id} Public

Delete a payment-method by ID

Request Example
DELETE /api/ecommerce/payment-methods/1
Accept: application/json
Response Example 200 OK
{
  "message": "Payment-method deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Products

Product catalog

GET /api/ecommerce/products Public

Retrieve a paginated list of all products

Request Example
GET /api/ecommerce/products
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "name": "MacBook Pro 16\"",
        "slug": "macbook-pro-16",
        "description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
        "price": 2499.989999999999781721271574497222900390625,
        "sale_price": 2299.989999999999781721271574497222900390625,
        "category_id": 2,
        "category_name": "Laptops",
        "stock": 25,
        "sku": "MBP-16-M2",
        "images": [
            "https://picsum.photos/600/600?random=prod1",
            "https://picsum.photos/600/600?random=prod1a"
        ],
        "rating": 4.79999999999999982236431605997495353221893310546875,
        "reviews_count": 124,
        "is_featured": true,
        "weight": 2.100000000000000088817841970012523233890533447265625,
        "dimensions": "35.79 x 24.81 x 1.68 cm"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/products/{id} Public

Retrieve a single product by ID

Request Example
GET /api/ecommerce/products/1
Accept: application/json
Response Example 200 OK
{
    "name": "MacBook Pro 16\"",
    "slug": "macbook-pro-16",
    "description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
    "price": 2499.989999999999781721271574497222900390625,
    "sale_price": 2299.989999999999781721271574497222900390625,
    "category_id": 2,
    "category_name": "Laptops",
    "stock": 25,
    "sku": "MBP-16-M2",
    "images": [
        "https://picsum.photos/600/600?random=prod1",
        "https://picsum.photos/600/600?random=prod1a"
    ],
    "rating": 4.79999999999999982236431605997495353221893310546875,
    "reviews_count": 124,
    "is_featured": true,
    "weight": 2.100000000000000088817841970012523233890533447265625,
    "dimensions": "35.79 x 24.81 x 1.68 cm"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested product does not exist"
}
POST /api/ecommerce/products Auth Required

Create a new product

Request Body
POST /api/ecommerce/products
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "MacBook Pro 16\"",
    "slug": "macbook-pro-16",
    "description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
    "price": 2499.989999999999781721271574497222900390625,
    "sale_price": 2299.989999999999781721271574497222900390625,
    "category_id": 2,
    "category_name": "Laptops",
    "stock": 25,
    "sku": "MBP-16-M2",
    "images": [
        "https://picsum.photos/600/600?random=prod1",
        "https://picsum.photos/600/600?random=prod1a"
    ],
    "rating": 4.79999999999999982236431605997495353221893310546875,
    "reviews_count": 124,
    "is_featured": true,
    "weight": 2.100000000000000088817841970012523233890533447265625,
    "dimensions": "35.79 x 24.81 x 1.68 cm"
}
Response Example 201 Created
{
    "name": "MacBook Pro 16\"",
    "slug": "macbook-pro-16",
    "description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
    "price": 2499.989999999999781721271574497222900390625,
    "sale_price": 2299.989999999999781721271574497222900390625,
    "category_id": 2,
    "category_name": "Laptops",
    "stock": 25,
    "sku": "MBP-16-M2",
    "images": [
        "https://picsum.photos/600/600?random=prod1",
        "https://picsum.photos/600/600?random=prod1a"
    ],
    "rating": 4.79999999999999982236431605997495353221893310546875,
    "reviews_count": 124,
    "is_featured": true,
    "weight": 2.100000000000000088817841970012523233890533447265625,
    "dimensions": "35.79 x 24.81 x 1.68 cm"
}
PUT/PATCH /api/ecommerce/products/{id} Auth Required

Update an existing product

Request Body
PUT /api/ecommerce/products/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "MacBook Pro 16\"",
    "slug": "macbook-pro-16",
    "description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
    "price": 2499.989999999999781721271574497222900390625,
    "sale_price": 2299.989999999999781721271574497222900390625,
    "category_id": 2,
    "category_name": "Laptops",
    "stock": 25,
    "sku": "MBP-16-M2",
    "images": [
        "https://picsum.photos/600/600?random=prod1",
        "https://picsum.photos/600/600?random=prod1a"
    ],
    "rating": 4.79999999999999982236431605997495353221893310546875,
    "reviews_count": 124,
    "is_featured": true,
    "weight": 2.100000000000000088817841970012523233890533447265625,
    "dimensions": "35.79 x 24.81 x 1.68 cm"
}
Response Example 200 OK
{
    "name": "MacBook Pro 16\"",
    "slug": "macbook-pro-16",
    "description": "Apple M2 Pro chip, 16GB RAM, 512GB SSD",
    "price": 2499.989999999999781721271574497222900390625,
    "sale_price": 2299.989999999999781721271574497222900390625,
    "category_id": 2,
    "category_name": "Laptops",
    "stock": 25,
    "sku": "MBP-16-M2",
    "images": [
        "https://picsum.photos/600/600?random=prod1",
        "https://picsum.photos/600/600?random=prod1a"
    ],
    "rating": 4.79999999999999982236431605997495353221893310546875,
    "reviews_count": 124,
    "is_featured": true,
    "weight": 2.100000000000000088817841970012523233890533447265625,
    "dimensions": "35.79 x 24.81 x 1.68 cm"
}
DELETE /api/ecommerce/products/{id} Auth Required

Delete a product by ID

Request Example
DELETE /api/ecommerce/products/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Product deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Reviews

Product reviews and ratings

GET /api/ecommerce/reviews Public

Retrieve a paginated list of all reviews

Request Example
GET /api/ecommerce/reviews
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "product_id": 1,
        "product_name": "MacBook Pro 16\"",
        "user_id": 1,
        "user_name": "John Anderson",
        "user_avatar": "https://i.pravatar.cc/50?img=12",
        "rating": 5,
        "title": "Best laptop I ever owned!",
        "comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
        "verified_purchase": true,
        "helpful_count": 45,
        "created_at": "2024-01-18T15:30:00Z"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/reviews/{id} Public

Retrieve a single review by ID

Request Example
GET /api/ecommerce/reviews/1
Accept: application/json
Response Example 200 OK
{
    "product_id": 1,
    "product_name": "MacBook Pro 16\"",
    "user_id": 1,
    "user_name": "John Anderson",
    "user_avatar": "https://i.pravatar.cc/50?img=12",
    "rating": 5,
    "title": "Best laptop I ever owned!",
    "comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
    "verified_purchase": true,
    "helpful_count": 45,
    "created_at": "2024-01-18T15:30:00Z"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested review does not exist"
}
POST /api/ecommerce/reviews Auth Required Auto User ID

Create a new review

Request Body
POST /api/ecommerce/reviews
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "product_id": 1,
    "product_name": "MacBook Pro 16\"",
    "user_id": 1,
    "user_name": "John Anderson",
    "user_avatar": "https://i.pravatar.cc/50?img=12",
    "rating": 5,
    "title": "Best laptop I ever owned!",
    "comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
    "verified_purchase": true,
    "helpful_count": 45
}
Response Example 201 Created
{
    "product_id": 1,
    "product_name": "MacBook Pro 16\"",
    "user_id": 1,
    "user_name": "John Anderson",
    "user_avatar": "https://i.pravatar.cc/50?img=12",
    "rating": 5,
    "title": "Best laptop I ever owned!",
    "comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
    "verified_purchase": true,
    "helpful_count": 45,
    "created_at": "2024-01-18T15:30:00Z"
}
PUT/PATCH /api/ecommerce/reviews/{id} Auth Required Ownership Check

Update an existing review

Only the owner can update this resource
Request Body
PUT /api/ecommerce/reviews/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "product_id": 1,
    "product_name": "MacBook Pro 16\"",
    "user_id": 1,
    "user_name": "John Anderson",
    "user_avatar": "https://i.pravatar.cc/50?img=12",
    "rating": 5,
    "title": "Best laptop I ever owned!",
    "comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
    "verified_purchase": true,
    "helpful_count": 45
}
Response Example 200 OK
{
    "product_id": 1,
    "product_name": "MacBook Pro 16\"",
    "user_id": 1,
    "user_name": "John Anderson",
    "user_avatar": "https://i.pravatar.cc/50?img=12",
    "rating": 5,
    "title": "Best laptop I ever owned!",
    "comment": "The M2 Pro chip is incredibly fast. Battery life is amazing. Highly recommend!",
    "verified_purchase": true,
    "helpful_count": 45,
    "created_at": "2024-01-18T15:30:00Z"
}
DELETE /api/ecommerce/reviews/{id} Auth Required Ownership Check

Delete a review by ID

Only the owner can delete this resource
Request Example
DELETE /api/ecommerce/reviews/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "Review deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Shipping-methods

Available shipping options

GET /api/ecommerce/shipping-methods Public

Retrieve a paginated list of all shipping-methods

Request Example
GET /api/ecommerce/shipping-methods
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "name": "Standard Shipping",
        "delivery_time": "5-7 business days",
        "cost": 5.9900000000000002131628207280300557613372802734375,
        "icon": "\ud83d\udce6",
        "description": "Regular delivery service"
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/shipping-methods/{id} Public

Retrieve a single shipping-method by ID

Request Example
GET /api/ecommerce/shipping-methods/1
Accept: application/json
Response Example 200 OK
{
    "name": "Standard Shipping",
    "delivery_time": "5-7 business days",
    "cost": 5.9900000000000002131628207280300557613372802734375,
    "icon": "\ud83d\udce6",
    "description": "Regular delivery service"
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested shipping-method does not exist"
}
POST /api/ecommerce/shipping-methods Public

Create a new shipping-method

Request Body
POST /api/ecommerce/shipping-methods
Content-Type: application/json

{
    "name": "Standard Shipping",
    "delivery_time": "5-7 business days",
    "cost": 5.9900000000000002131628207280300557613372802734375,
    "icon": "\ud83d\udce6",
    "description": "Regular delivery service"
}
Response Example 201 Created
{
    "name": "Standard Shipping",
    "delivery_time": "5-7 business days",
    "cost": 5.9900000000000002131628207280300557613372802734375,
    "icon": "\ud83d\udce6",
    "description": "Regular delivery service"
}
PUT/PATCH /api/ecommerce/shipping-methods/{id} Public

Update an existing shipping-method

Request Body
PUT /api/ecommerce/shipping-methods/1
Content-Type: application/json

{
    "name": "Standard Shipping",
    "delivery_time": "5-7 business days",
    "cost": 5.9900000000000002131628207280300557613372802734375,
    "icon": "\ud83d\udce6",
    "description": "Regular delivery service"
}
Response Example 200 OK
{
    "name": "Standard Shipping",
    "delivery_time": "5-7 business days",
    "cost": 5.9900000000000002131628207280300557613372802734375,
    "icon": "\ud83d\udce6",
    "description": "Regular delivery service"
}
DELETE /api/ecommerce/shipping-methods/{id} Public

Delete a shipping-method by ID

Request Example
DELETE /api/ecommerce/shipping-methods/1
Accept: application/json
Response Example 200 OK
{
  "message": "Shipping-method deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}

Users

Customer accounts

GET /api/ecommerce/users Auth Required User Filtering

Retrieve a paginated list of all users

Request Example
GET /api/ecommerce/users
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "data": [
    {
        "id": 1,
        "name": "John Anderson",
        "email": "john@example.com",
        "password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
        "api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
        "phone": "+1-555-0101",
        "avatar": "https://i.pravatar.cc/150?img=12",
        "role": "customer",
        "joined_at": "2023-01-15",
        "orders_count": 12,
        "total_spent": 3456.78000000000020008883439004421234130859375
    },
    ...
  ],
  "meta": {
    "current_page": 1,
    "total": 50,
    "per_page": 15
  }
}
GET /api/ecommerce/users/{id} Auth Required

Retrieve a single user by ID

Request Example
GET /api/ecommerce/users/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
    "id": 1,
    "name": "John Anderson",
    "email": "john@example.com",
    "password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
    "api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
    "phone": "+1-555-0101",
    "avatar": "https://i.pravatar.cc/150?img=12",
    "role": "customer",
    "joined_at": "2023-01-15",
    "orders_count": 12,
    "total_spent": 3456.78000000000020008883439004421234130859375
}
Error Response 404 Not Found
{
  "error": "Resource not found",
  "message": "The requested user does not exist"
}
POST /api/ecommerce/users Public

Create a new user

Request Body
POST /api/ecommerce/users
Content-Type: application/json

{
    "name": "John Anderson",
    "email": "john@example.com",
    "password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
    "api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
    "phone": "+1-555-0101",
    "avatar": "https://i.pravatar.cc/150?img=12",
    "role": "customer",
    "joined_at": "2023-01-15",
    "orders_count": 12,
    "total_spent": 3456.78000000000020008883439004421234130859375
}
Response Example 201 Created
{
    "id": 1,
    "name": "John Anderson",
    "email": "john@example.com",
    "password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
    "api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
    "phone": "+1-555-0101",
    "avatar": "https://i.pravatar.cc/150?img=12",
    "role": "customer",
    "joined_at": "2023-01-15",
    "orders_count": 12,
    "total_spent": 3456.78000000000020008883439004421234130859375
}
PUT/PATCH /api/ecommerce/users/{id} Auth Required Ownership Check

Update an existing user

Only the owner can update this resource
Request Body
PUT /api/ecommerce/users/1
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
    "name": "John Anderson",
    "email": "john@example.com",
    "password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
    "api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
    "phone": "+1-555-0101",
    "avatar": "https://i.pravatar.cc/150?img=12",
    "role": "customer",
    "joined_at": "2023-01-15",
    "orders_count": 12,
    "total_spent": 3456.78000000000020008883439004421234130859375
}
Response Example 200 OK
{
    "id": 1,
    "name": "John Anderson",
    "email": "john@example.com",
    "password": "$2y$12$Np.sWfvPM1Z5hz0RTa0q9eQ4gTA4k73cCyAcFqW8lObMp0EvbJq9W",
    "api_token": "815c784f9d64d7efce4c932db8416cf6dee2194c73e79e1a5a22683b14a9722f",
    "phone": "+1-555-0101",
    "avatar": "https://i.pravatar.cc/150?img=12",
    "role": "customer",
    "joined_at": "2023-01-15",
    "orders_count": 12,
    "total_spent": 3456.78000000000020008883439004421234130859375
}
DELETE /api/ecommerce/users/{id} Auth Required Ownership Check

Delete a user by ID

Only the owner can delete this resource
Request Example
DELETE /api/ecommerce/users/1
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
Response Example 200 OK
{
  "message": "User deleted successfully"
}
Error Response 500 Error
{
  "error": "Deletion failed",
  "message": "Unable to delete the resource"
}