Overview
Allows store employees to move an order through its lifecycle stages. Each status transition is validated to ensure orders follow the correct workflow. When an order is marked asready, a 6-digit OTP is automatically generated and sent to the customer via email and push notification.
Authentication
Requires authentication with JWT token. Only available tostore_employee role.
Endpoint
Path parameters
The unique order ID (MongoDB ObjectId)
Request body
The new order statusValid transitions:
placed→acceptedaccepted→processingprocessing→readyready→picked_up
Response
Indicates if the order status was updated successfully
Human-readable status message
Order lifecycle
Status transition rules
placed → accepted
- Payment status must be
success - If customer has no-show history (watch/restricted tier),
isCommitmentConfirmedmust betrue - Customer receives “Order Accepted” notification
accepted → processing
- Store starts preparing the order
- Customer receives “Order Being Prepared” notification
processing → ready
- Order preparation is complete
- 6-digit OTP is generated and sent to customer
readyAttimestamp is setreadyExpiresAtis set to 20 minutes from now- Customer must collect order within 20 minutes or it’s marked as no-show
- Customer receives “Order Ready for Pickup” notification with OTP
ready → picked_up
- OTP must be verified first using POST /api/orders/:id/verify-otp
- Customer receives “Order Collected” notification
Example request
Example response (ready status)
Error responses
OTP generation details
When transitioning toready status:
- 6-digit numeric OTP is generated
- OTP expires in 10 minutes (configurable)
- OTP is sent via:
- Email to customer
- Push notification to customer’s devices
- OTP is returned in the API response for store’s reference
- Store must verify this OTP when customer arrives
The OTP is only included in the response when the status changes to
ready. It is not returned for other status transitions.Commitment confirmation
Customers with no-show history must confirm their commitment before stores can accept orders:- Trust tier: good - No commitment required
- Trust tier: watch - Commitment required if no-show count ≥ 2
- Trust tier: restricted - Always requires commitment