- Ordering
Order checkout integration event
The order checkout integration event enables customization of order total calculations, including taxes, shipping costs, fees, and promotion discounts. This feature recognizes that companies often have established requirements and existing relationships with third-party vendors for calculating these costs. Since there is no universal solution for these calculations, the integration provides flexibility to implement business-specific requirements.
Common scenarios
The integration addresses various business needs:
-
Shipping cost variations:
- Vendor-specific rates
- Product type considerations
- Packaging material requirements
- Fulfillment-time factors
-
Promotion management:
- Item-specific discounts
- Targeted price adjustments
- Individual item vs. order-level promotions
-
Tax handling:
- Tax-exempt user groups
- Multiple jurisdiction requirements
- Special tax rules
- Custom tax calculations
Integration overview
The integration connects your middleware application through predefined routes, providing control over order total calculations. The process includes:
-
Cart management:
- Item selection
- Configuration options
- Quantity adjustments
-
Shipment organization:
- Ship from address
- Ship to address
- Production lead time
- Customer delivery requirements
- Inventory availability
- Fulfillment constraints
-
Shipping options:
- Method selection
- Price comparison
- Delivery time estimates
- Service level options
-
Cost calculations:
- Tax computation
- Line item pricing
- Price break application
- Promotion processing
Triggering behavior
The integration uses explicit triggering through POST /v1/orders/{direction}/{orderID}/calculate rather than automatic calculation. This approach provides several benefits:
-
Performance optimization:
- Prevents redundant calculations
- Reduces API calls
- Minimizes third-party service costs
-
User experience:
- Faster response times
- Controlled calculation timing
- Predictable behavior
-
Resource management:
- Efficient service usage
- Controlled costs
- Optimized processing
Security verification:
- Each call includes
X-oc-hashheader - Signature uses integration event hash key
- Validates serialized JSON payload
- Uses HMACSHA256 encoding
Standard checkout flow
-
Cart management:
- Add items to order
- Configure item options
- Set quantities
-
Address handling:
- Set shipping addresses
- Validate locations
- Configure multiple addresses if needed
-
Shipping estimation:
- Retrieves available shipping methods
- Calculates costs
- Provides delivery estimates
-
Method selection:
- Present options to user
- Show costs and transit times
- Allow comparison
-
Save shipping choices:
json -
Calculate totals:
- Computes all costs
- Applies promotions
- Validates totals
-
Order submission:
- Finalizes order
- Triggers fulfillment
- Processes payment
Important notes:
- Order changes invalidate calculations
- Recalculation required after changes
- Changes include:
- Shipping costs
- Tax amounts
- Promotion adjustments
- Address updates
- Quantity modifications
- Unit price changes
- Cost center updates
- Order/line item XP changes
Order worksheet
The Order Worksheet serves as a comprehensive record of calculation data:
Benefits:
- Detailed cost breakdown
- Tax calculation history
- Shipping rate records
- Promotion application details
- Fee itemization
- Historical reference
- Audit trail
- Refund calculation support
Implementation
Setup requirements:
-
Integration configuration:
- Create OrderCheckout Integration Event Type
- Configure API Client connection
- Set OrderCheckoutIntegrationEventID
-
Endpoint hosting:
- Implement required routes
- Handle integration payloads
- Process calculations
- Return formatted responses
Standard payload structure:
Integration endpoints
/ShippingRates
Triggered by: POST v1/orders/{direction}/{orderID}/estimateshipping
Purpose:
- Calculate shipping options
- Group items into shipments
- Provide cost estimates
- Define delivery timeframes
Response structure:
/OrderCalculate
Triggered by: POST v1/orders/{direction}/{orderID}/calculate
Purpose:
- Calculate final totals
- Apply tax rules
- Process shipping costs
- Handle fees
- Override unit prices
- Store calculation details
Response structure:
Important: Middleware order updates must occur after sending the response to OrderCloud.
/OrderSubmit
Triggered by: POST v1/orders/{direction}/{orderID}/submit
Purpose:
- Process final submission
- Integrate with back-office systems
- Initialize fulfillment
- Record external references
Response structure:
/OrderSubmitForApproval
Triggered by: POST v1/orders/{direction}/{orderID}/submit
Purpose:
- Handle approval workflow
- Process pending orders
- Notify approvers
- Track approval status
Response structure:
/OrderApproved
Triggered by: POST v1/orders/{direction}/{orderID}/approve
Purpose:
- Process approved orders
- Initialize fulfillment
- Update systems
- Notify stakeholders
Response structure: