All order endpoints require authentication. Include a valid authentication token in your request headers.
Create Order
Create a new order. This endpoint validates stock availability, creates the order, reduces product stock, and sends confirmation emails.Authentication
Required. User must be authenticated via Clerk.Request Body
Array of items to order
Product object with
_id fieldProduct name (optional, will use product data if not provided)
Product price at time of order
Quantity ordered (minimum 1)
Shipping address details
Recipient’s full name
Street address
City
Contact phone number
Payment result information
Payment transaction ID
Payment status (e.g., “succeeded”, “pending”)
Total order price
Response
Success message
The created order object
Order unique identifier
User ID reference
Clerk user ID
Array of ordered items
Shipping address details
Payment result information
Total order price
Order status: “pending”, “paid”, “in_preparation”, “ready”, “delivered”, “canceled”, “rejected”
ISO 8601 timestamp of order creation
Example Request
Example Response
Error Responses
400 Bad Request
No order items or insufficient stock
404 Not Found
Product not found
Get User Orders
Retrieve all orders for the authenticated user, sorted by most recent first. Includes review status for each order.Authentication
Required. User must be authenticated via Clerk.Response
Array of order objects
Order unique identifier
Array of ordered items with populated product details (name, images, price)
Shipping address details
Total order price
Current order status
Whether the user has reviewed this order
ISO 8601 timestamp of order creation
ISO 8601 timestamp when order was paid
ISO 8601 timestamp when order was delivered
Example Request
Example Response
Download Invoice
Download a PDF invoice for a paid or delivered order.Authentication
Required. User must be authenticated via Clerk and must own the order.Path Parameters
The order ID to download invoice for
Response
Returns a PDF file asapplication/pdf with filename factura-FV-YYYY-XXXXXXXX.pdf.
Example Request
Error Responses
400 Bad Request
Invoice only available for paid or delivered orders
403 Forbidden
User is not authorized to access this order
404 Not Found
Order not found