PATCH /api/orders/:id/status
Allows administrators to manually update an order’s status and transaction hash. This is typically used for manual interventions, refunds, or resolving payment issues.Authentication
Requires JWT authentication token with admin role in the Authorization header.Authorization
Only users withrole: 'admin' can access this endpoint.
Path Parameters
MongoDB ObjectId of the order to update
Request Body
New order status. Valid values:
pending, completed, refundedBlockchain transaction hash (optional, used when manually adding transaction proof)
Response
Indicates if the status was updated successfully
Confirmation message
Valid Status Transitions
Administrators can set the following statuses:- pending - Reset order to pending state
- completed - Mark order as successfully completed
- refunded - Mark order as refunded to customer
Common Use Cases
- Manual Refund - Change status to
refundedafter processing a blockchain refund transaction - Manual Completion - Mark as
completedif blockchain confirmation was missed - Add Transaction Hash - Update order with transaction hash if it was missing
- Reset Order - Return to
pendingif payment needs to be retried
Error Responses
400 Bad Request - Invalid statusExample Request
Example Response
Important Notes
- This endpoint is restricted to admin users only
- The
updatedAttimestamp is automatically updated - Only three status values are allowed:
pending,completed,refunded - The transaction hash is optional and only needs to be provided when adding/updating transaction proof
- No stock adjustments or refund transactions are automatically processed - this endpoint only updates the order record
- For complete refund workflows, admins should:
- Process the blockchain refund transaction separately
- Use this endpoint to update the order status to ‘refunded’
- Include the refund transaction hash in the request