Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AndrewwCO/Panahashi-Backend/llms.txt

Use this file to discover all available pages before exploring further.

The Orders API manages the complete lifecycle of a customer order — from placement through QR-code-verified pickup. Customers create orders and track their status; bakers manage fulfillment and scan QR codes at pickup; admins can view all orders across the platform.

Order statuses

StatusDescription
PENDINGOrder placed, awaiting baker confirmation
CONFIRMEDBaker confirmed the order
BAKINGBaker is preparing the order
READYOrder is ready for pickup
COMPLETEDCustomer picked up — QR verified
CANCELLEDOrder was cancelled (stock is restored)

Order object

id
string
Unique order ID.
userId
string
Firebase UID of the customer.
userName
string
Customer display name.
bakeryId
string
ID of the bakery.
bakeryName
string
Name of the bakery.
items
CartItem[]
List of ordered items with productId, name, price, emoji, qty.
total
number
Total price after any discount.
status
string
Current order status.
qrCode
string
UUID string for QR pickup verification.
pickupTime
string
Requested pickup time string (e.g. “10:30”).
scheduledFor
integer
Optional scheduled pickup epoch ms.
estimatedReadyAt
integer
Baker-set estimated ready epoch ms.
discountAmount
number
Discount applied from a promotion.
promotionId
string
ID of applied promotion, if any.
paymentStatus
string
One of: PENDING, APPROVED, REJECTED, REFUNDED.
paymentMethod
string
One of: CREDIT_CARD, DEBIT_CARD, PSE, CASH_ON_PICKUP.
notes
string
Optional customer notes.
createdAt
integer
Creation epoch ms.

POST /api/v1/orders

Places a new order. The bakery must be open, products must be in stock, and pickup time must fall within the bakery’s hours. Auth required: Yes — CUSTOMER
Pass the customer’s display name in the X-User-Name request header. It is stored on the order and shown to the baker. If omitted, it defaults to "Cliente".
bakeryId
string
required
Target bakery ID.
items
object[]
required
Array of items to order.
pickupTime
string
required
Requested pickup time, e.g. “10:30”.
scheduledFor
integer
Epoch ms for advance scheduled orders.
notes
string
Optional notes for the baker.
paymentMethod
string
required
One of: CREDIT_CARD, DEBIT_CARD, PSE, CASH_ON_PICKUP.
promotionId
string
Optional promotion ID to apply a discount.
curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "bakeryId": "bak001",
    "items": [{"productId": "prod001", "qty": 2}],
    "pickupTime": "10:30",
    "paymentMethod": "CASH_ON_PICKUP"
  }' \
  http://localhost:8080/api/v1/orders
Response example:
{
  "success": true,
  "data": {
    "id": "ord789",
    "status": "PENDING",
    "total": 7.0,
    "qrCode": "A1B2C3D4-E5F6-...",
    "paymentStatus": "PENDING"
  }
}
For CASH_ON_PICKUP orders, the baker is notified via FCM immediately after order creation. For card payments, the notification fires after payment is approved via the Payments API.

GET /api/v1/orders/me

Returns the authenticated customer’s orders, newest first. Auth required: Yes — CUSTOMER
page
integer
Page number (1-indexed). Default: 1.
pageSize
integer
Results per page. Default: 20.
curl -H "Authorization: Bearer <token>" \
  "http://localhost:8080/api/v1/orders/me?page=1&pageSize=10"

GET /api/v1/orders/

Returns a single order. Customers can only retrieve their own orders. Auth required: Yes — CUSTOMER
id
string
required
Order ID.
curl -H "Authorization: Bearer <token>" \
  http://localhost:8080/api/v1/orders/ord789

PATCH /api/v1/orders//status

Updates the status of an order. Baker must own the order’s bakery. Auth required: Yes — BAKER
id
string
required
Order ID.
status
string
required
New status: CONFIRMED, BAKING, READY, or CANCELLED.
curl -X PATCH \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"status":"CONFIRMED"}' \
  http://localhost:8080/api/v1/orders/ord789/status
Cancelling an order (CANCELLED) automatically restores stock for all items. Completing an order adds a loyalty stamp for the customer.

PATCH /api/v1/orders//estimated-ready

Sets the baker’s estimated ready time for an order, sent to the customer via FCM notification. Auth required: Yes — BAKER
id
string
required
Order ID.
estimatedReadyAt
integer
required
Epoch milliseconds of estimated ready time.
curl -X PATCH \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"estimatedReadyAt":1716220800000}' \
  http://localhost:8080/api/v1/orders/ord789/estimated-ready

POST /api/v1/orders/verify-qr

Verifies a customer’s QR code at pickup. The order must be in READY status; on success, status is set to COMPLETED. Auth required: Yes — BAKER
qrCode
string
required
QR code string from the customer’s order.
curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"qrCode":"A1B2C3D4-E5F6-..."}' \
  http://localhost:8080/api/v1/orders/verify-qr
QR verification only succeeds when the order is in READY status and belongs to the baker’s bakery.

Baker order views

GET /api/v1/orders/bakery

All orders for the baker’s bakery, paginated. Auth required: Yes — BAKER
page
integer
Page. Default: 1.
pageSize
integer
Per page. Default: 20.

GET /api/v1/orders/bakery/pending

Only PENDING orders for the baker’s bakery. Auth required: Yes — BAKER

GET /api/v1/orders/bakery/active

Active orders in statuses PENDING, CONFIRMED, or BAKING. Auth required: Yes — BAKER

GET /api/v1/orders/all

Returns all orders across the platform, paginated. Auth required: Yes — ADMIN
page
integer
Page. Default: 1.
pageSize
integer
Per page. Default: 20.

Build docs developers (and LLMs) love