Update Sale Status
Sales
Update Sale Status
Update the status of a sale order (admin only)
PUT
Update Sale Status
Authentication
This endpoint requires authentication with admin privileges.Path Parameters
number
required
The unique identifier of the sale to update
Request Body
string
required
The new status for the sale. Must be one of:
PENDIENTE_PAGO- Pending paymentPENDIENTE_APROBACION- Pending approval (awaiting payment verification)APROBADO- Approved and ready to be preparedENVIADO- Shipped/dispatchedENTREGADO- Delivered to customerRECHAZADO- Rejected (payment failed or order cancelled by admin)CANCELADO- Cancelled by customer or admin
Response
boolean
Indicates if the request was successful
object
string
Error message if the request failed
Related Endpoints
Dispatch Sale
PUT /api/sales/:id/dispatch
Specialized endpoint to mark a sale as dispatched with tracking information.
Request Body:
string
required
Tracking code for the shipment
ENVIADO and sets the tracking code.
Cancel Order
PUT /api/sales/:id/cancel
Allows users to cancel their own order. Updates the status to CANCELADO and restores product stock.
Authentication: Regular user authentication (users can cancel their own orders)
Sale Status Workflow
Typical status progression:- PENDIENTE_PAGO - Initial state after sale creation
- PENDIENTE_APROBACION - Payment proof uploaded, awaiting verification
- APROBADO - Payment confirmed, order ready for preparation
- ENVIADO - Order shipped with tracking code
- ENTREGADO - Order delivered to customer
- RECHAZADO - Payment failed or order rejected
- CANCELADO - Order cancelled by customer or admin
Example Request
Example Response
Example Request - Dispatch Sale
Example Response - Dispatch Sale
Example Request - Cancel Order
Example Response - Cancel Order
Error Responses
Invalid Status (400)
Missing Tracking Code (400) - Dispatch endpoint
Unauthorized (401)
Forbidden - Not Admin (403)
Sale Not Found (404)
Notes
- Only admin users can update sale status via
/api/sales/:id/status - The
/api/sales/:id/dispatchendpoint is a convenience method for shipping orders - The
/api/sales/:id/cancelendpoint can be used by regular users to cancel their own orders - Cancelling an order restores the product stock that was reserved
- Status changes may trigger email notifications to customers
- Once a sale is marked as
ENTREGADO, it should not be changed to other statuses - Status transitions should follow the logical workflow to maintain data integrity