POST /api/create-order
Creates a new order, reserves inventory, and generates a shipment with the logistics provider (Venndelo).Request Body
Customer billing information
First name
Last name
Email address
Phone number
ID type (e.g., “CC”, “NIT”)
Identification number
Shipping destination information
Recipient first name
Recipient last name
Delivery address
DANE city code
DANE department code
Country code (e.g., “CO”)
Recipient phone
Postal code (optional)
Array of products to order
Product SKU
Product name
Unit price
Quantity
Weight in kilograms
Weight unit (must be “KG”)
Dimensions unit (must be “CM”)
Height in centimeters
Width in centimeters
Length in centimeters
Item type: “STANDARD” or “VIRTUAL” (default: “STANDARD”)
Payment method: “COD” (cash on delivery) or “EXTERNAL_PAYMENT” (Wompi)
External order reference ID
Optional pickup location (if different from default warehouse)
Optional discounts array
Response
Indicates if order was created successfully
Order details
Internal database UUID
Human-readable order number (e.g., 1050)
Venndelo shipment ID
Total amount including shipping
Shipping cost
Logistics carrier name
Tracking number (if available)
Example Request
Example Response
Order Processing Flow
- Validation: Request data is validated using Zod schema
- Stock Reservation: Inventory is reserved for all line items
- Database Creation: Order is created with status
PENDING - Logistics Integration: Shipment is created with Venndelo
- Confirmation: Order is updated with external ID and shipping cost
- Email Notification: Confirmation email sent (COD orders only)
Payment Methods
COD (Cash on Delivery)
Whenpayment_method_code: "COD":
- Stock is immediately confirmed (deducted from inventory)
- Order confirmation email is sent immediately
- Payment collected upon delivery
EXTERNAL_PAYMENT (Wompi)
Whenpayment_method_code: "EXTERNAL_PAYMENT":
- Stock is reserved but not confirmed
- Stock confirmed after webhook payment confirmation
- Email sent after payment confirmation
Error Responses
400 Bad Request - Invalid Data
409 Conflict - Insufficient Stock
500 Internal Server Error - Database Error
502 Bad Gateway - Logistics Error
Rollback Mechanism
The endpoint implements automatic rollback on failures:
- If logistics creation fails, the order is cancelled and stock is released
- If database save fails, stock reservation is released
- All operations are atomic to prevent inconsistent states