orderCreate
Create a new order with comprehensive order data and associated entities.
Establishes a complete order in the system including all necessary components for order processing and fulfillment. This operation creates the order record along with all associated entities in a single transaction to ensure data consistency.
The order creation process includes:
- Order header with customer and business information
- Order items with product details, quantities, and pricing
- Billing and delivery addresses (exactly 2 addresses required: 1 invoice, 1 delivery)
- Payment information including totals, taxes, and payment method details
- Shipping/postage information with carrier and service details
- Initial order status and audit trail creation
Validation requirements:
- Addresses must include exactly one invoice and one delivery address
- Order items must have valid product references and positive quantities
- Financial totals must be consistent across payment, postage, and total sections
- All required fields must be provided according to business rules
The created order will be assigned a unique ID and UUID, and will trigger order creation events for downstream systems.
Possible errors:
- ORDER_CREATE_ERROR: Failed to create the order due to system error
- ORDER_ITEM_CREATE_ERROR: Failed to create one or more order items
- ORDER_ADDRESS_CREATE_ERROR: Failed to create order addresses
- VALIDATION_ERROR: Input validation failed (invalid data format, missing required fields, invalid references)
- FORBIDDEN: Insufficient permissions to create orders
AUTH: Role=[order.OWNER] OR (('user is authenticated') AND ('userId if present in input matches JWT' AND 'companyId(s) if present in input matches JWT'))
orderCreate(
order: OrderCreateInput!
): Order!
Arguments
orderCreate.order ● OrderCreateInput! non-null input
Complete order creation data including all necessary information for order establishment.
Contains comprehensive order information required to create a fully functional order:
Required components:
- Order items: Array of products with quantities, pricing, and product details
- Addresses: Exactly 2 addresses (1 invoice address, 1 delivery address)
- Payment data: Financial totals including net, gross, tax amounts and payment method
- Postage data: Shipping costs and carrier information
- Total data: Consolidated financial summary with currency information
Optional components:
- Cart ID: Reference to shopping cart if order originates from cart
- Customer information: User ID and customer details
- External references: Integration with external systems
- Custom fields: Additional metadata for business-specific requirements
All financial amounts must be consistent and properly calculated. Addresses must include complete contact information. Order items must reference valid products with positive quantities.
Type
Order object
Order entity representing a customer order.
External entity from the order service. Used as a reference for order-specific attributes within the attribute system.