curl --request PUT \
--url https://api.example.com/api/sales/:id/status \
--header 'Content-Type: application/json' \
--data '
{
"status": "<string>",
"trackingCode": "<string>"
}
'{
"success": true,
"data": {
"id": 123,
"fecha": "<string>",
"montoTotal": 123,
"estado": "<string>",
"medioPago": "<string>",
"tipoEntrega": "<string>",
"costoEnvio": 123,
"clienteId": 123,
"lineasVenta": [
{}
]
},
"error": "<string>"
}Update the status of a sale order (admin only)
curl --request PUT \
--url https://api.example.com/api/sales/:id/status \
--header 'Content-Type: application/json' \
--data '
{
"status": "<string>",
"trackingCode": "<string>"
}
'{
"success": true,
"data": {
"id": 123,
"fecha": "<string>",
"montoTotal": 123,
"estado": "<string>",
"medioPago": "<string>",
"tipoEntrega": "<string>",
"costoEnvio": 123,
"clienteId": 123,
"lineasVenta": [
{}
]
},
"error": "<string>"
}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 adminPUT /api/sales/:id/dispatch
Specialized endpoint to mark a sale as dispatched with tracking information.
Request Body:
ENVIADO and sets the tracking code.
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)
{
"status": "APROBADO"
}
{
"success": true,
"data": {
"id": 789,
"fecha": "2026-03-05T10:30:00.000Z",
"montoTotal": 50000,
"estado": "APROBADO",
"medioPago": "TRANSFERENCIA",
"tipoEntrega": "ENVIO",
"costoEnvio": 5000,
"clienteId": 42,
"direccionEnvio": "Av. Corrientes 1234",
"lineasVenta": [
{
"id": 1,
"productoId": 123,
"cantidad": 2,
"subTotal": 30000
},
{
"id": 2,
"productoId": 456,
"cantidad": 1,
"subTotal": 15000
}
]
}
}
PUT /api/sales/789/dispatch
{
"trackingCode": "AR123456789"
}
{
"success": true,
"data": {
"id": 789,
"estado": "ENVIADO",
"codigoSeguimiento": "AR123456789",
"montoTotal": 50000,
"fecha": "2026-03-05T10:30:00.000Z"
}
}
PUT /api/sales/789/cancel
{
"success": true,
"data": {
"id": 789,
"estado": "CANCELADO",
"montoTotal": 50000,
"fecha": "2026-03-05T10:30:00.000Z"
}
}
{
"success": false,
"error": "Invalid status"
}
{
"success": false,
"error": "Tracking required"
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Admin access required"
}
{
"success": false,
"error": "Venta no encontrada"
}
/api/sales/:id/status/api/sales/:id/dispatch endpoint is a convenience method for shipping orders/api/sales/:id/cancel endpoint can be used by regular users to cancel their own ordersENTREGADO, it should not be changed to other statuses