POST /api/orders/:id/confirm-commitment
Confirms the user’s commitment to pick up an order. This endpoint is required for users with a history of no-shows (trust tier “watch” or “restricted”) who have pending orders that require explicit commitment confirmation.Authentication
Requires a valid JWT access token in theAuthorization header.
Allowed roles: student, faculty
Path parameters
The order ID
Response
Indicates if the commitment was confirmed successfully
Confirmation message
Updated order object with commitment confirmed
Example request
cURL
Example responses
200 Success
400 Already confirmed
400 Commitment expired
400 No commitment required
403 Not your order
404 Order not found
How it works
Trust tier system
Users are assigned a trust tier based on their no-show history:- good: 0-1 no-shows (no commitment required)
- watch: 2 no-shows (commitment required, 4-minute window)
- restricted: 3+ no-shows (ordering temporarily blocked for 14 days)
Commitment workflow
- User with no-show history creates an order
- Order is created with
requiresCommitment: trueand statusplaced - User must call this endpoint within 4 minutes of order creation
- If confirmed, order proceeds normally
- If not confirmed within 4 minutes, order is automatically cancelled
Automatic cancellation
Orders requiring commitment that are not confirmed within 4 minutes are automatically cancelled by the backend’s timeout sweep. This prevents users from placing orders they won’t pick up.The commitment deadline is typically 4 minutes from order creation, but can be configured via the
ORDER_COMMITMENT_TIMEOUT_MINUTES environment variable.Related endpoints
- Create order - Create a new order
- Get order - Check if commitment is required
- Poll order status - Monitor order status changes