We’re implementing complex pricing rules for our CPQ process in Zendesk Sell - volume discounts, bundle pricing, contract term adjustments, and customer-specific pricing tiers. The question is where to implement this logic: directly in API layer using Zendesk’s pricing APIs, or in external middleware that calculates prices and pushes results back to Zendesk. Implementing in the API layer keeps everything centralized but makes the code complex and harder to test. External middleware is cleaner architecturally but adds another system to maintain and introduces potential sync issues. We’re also concerned about upgrade impacts - if we build heavily customized API integrations, how painful are Zendesk Sell version upgrades? What architectural patterns have worked for others implementing sophisticated CPQ logic while maintaining long-term maintainability?
Balancing API complexity and maintainability when implementing custom pricing logic in CPQ workflows
We use a hybrid approach. Simple pricing rules live in Zendesk’s native configuration where possible. Complex logic that requires external data or heavy computation goes to middleware. The key is defining clear boundaries - if a rule can be expressed as a simple percentage or lookup table, keep it in Zendesk. If it requires calling other APIs or complex algorithms, use middleware.
From an operational perspective, middleware adds deployment complexity but improves flexibility. You can update pricing logic independently of Zendesk releases. We deploy pricing changes weekly, but Zendesk upgrades are quarterly. Having separation lets us iterate faster. Just make sure you have proper version control and rollback capabilities for the middleware.
External middleware sounds good in theory but creates operational complexity. You now have two systems that need to stay in sync. What happens when the middleware is down but sales needs to generate a quote? We tried this and ended up implementing fallback logic in Zendesk anyway for high-availability scenarios, which meant maintaining pricing rules in two places.
This discussion highlights the key architectural decision for CPQ implementations: balancing system integration versus separation of concerns. Here’s a framework for making this decision based on complexity and maintainability requirements.
Custom Logic in API Layer:
Implementing pricing logic directly using Zendesk Sell’s APIs means:
Advantages:
- Single system to maintain and monitor
- No additional infrastructure costs
- Lower latency (no external calls)
- Simpler deployment pipeline
- Native integration with Zendesk workflows
Disadvantages:
- Complexity concentrated in integration code
- Difficult to unit test in isolation
- Tightly coupled to Zendesk API versions
- Limited reusability across other systems
- Harder to implement sophisticated algorithms
- Upgrade risk when Zendesk changes APIs
Appropriate Use Cases:
- Straightforward discount structures (percentage-based, volume tiers)
- Pricing rules based solely on Zendesk data
- Small to medium complexity (under 10 pricing rules)
- Organizations with limited DevOps capabilities
External Middleware Options:
Separating pricing logic into dedicated middleware provides:
Advantages:
- Clean separation of concerns
- Independent testing and deployment
- Reusable across multiple systems
- Technology flexibility (use optimal language/framework)
- Easier to implement complex algorithms
- Reduced upgrade risk from Zendesk changes
- Better performance for compute-intensive calculations
Disadvantages:
- Additional infrastructure to manage
- Potential sync and consistency issues
- Higher latency for external calls
- Requires robust error handling and fallbacks
- More complex deployment and monitoring
- Operational overhead of multiple systems
Appropriate Use Cases:
- Complex multi-variable pricing (10+ rules)
- Integration with external data sources (ERP, pricing databases)
- Sophisticated algorithms (optimization, ML-based pricing)
- Need to share logic across multiple channels
- High-volume quote generation requiring optimization
Upgrade and Maintenance Risk:
The upgrade concern is legitimate but manageable:
API Layer Approach:
- Expect 20-40 hours testing per major Zendesk upgrade
- API contracts generally stable but implementation details change
- Workarounds for API quirks may break between versions
- Custom code tightly coupled to specific API versions
Middleware Approach:
- Upgrade impact limited to integration points
- Core pricing logic unaffected by Zendesk changes
- Can version middleware independently
- Still need to test integration layer during upgrades
Recommended Architecture Pattern:
Based on the discussion and our experience, implement a Tiered Hybrid Architecture:
Tier 1 - Native Zendesk Configuration: Use Zendesk’s built-in pricing features for:
- Standard product pricing
- Simple percentage discounts
- Basic volume tiers (if supported natively)
- List price management
Tier 2 - API Layer Extensions: Implement in Zendesk API integration for:
- Customer-specific pricing lookups
- Contract term adjustments
- Simple bundle pricing
- Rules requiring only Zendesk data
Tier 3 - External Pricing Engine: Build middleware microservice for:
- Complex multi-variable calculations
- External data integration (competitor pricing, cost data)
- Approval workflow logic
- Advanced bundle and configuration rules
- Customer-specific algorithmic pricing
Implementation Guidelines:
- Start Simple: Begin with Tier 1/2, move to Tier 3 only when complexity justifies it
- Clear Boundaries: Document which rules live where and why
- Fallback Strategy: Implement basic pricing in Zendesk as fallback if middleware unavailable
- Version Control: Tag middleware releases with compatible Zendesk versions
- Integration Testing: Automated tests for all pricing scenarios across tiers
- Monitoring: Track pricing calculation success rates and latency
Specific Recommendations for Your Scenario:
Given your requirements (volume discounts, bundles, term adjustments, customer tiers), I recommend:
- Volume Discounts: Tier 2 (API layer) if simple percentage-based, Tier 3 if complex calculation
- Bundle Pricing: Tier 3 (middleware) - typically requires sophisticated logic
- Contract Terms: Tier 2 (API layer) - usually straightforward multiplication
- Customer Tiers: Tier 3 (middleware) - enables centralized customer data integration
This hybrid approach gives you maintainability benefits of separation while avoiding unnecessary complexity. Start with 70% in Tier 2, 30% in Tier 3, and adjust based on actual complexity encountered.
The key to long-term maintainability is not choosing one approach exclusively, but thoughtfully distributing logic based on complexity, reusability needs, and operational capabilities. Document the decision criteria so future developers understand the architecture rationale.
The high-availability concern is real. How do you handle the sync timing? Do you calculate prices in real-time as users configure quotes, or batch-process them? Real-time would require the middleware to be highly available and fast.
Consider upgrade and maintenance risk carefully. In zs-2021, the pricing API had some quirks that required workarounds. When we upgraded to zs-2023, several of those workarounds broke because the API behavior changed. If you build deep customizations directly against the API, budget significant time for testing and updates during version upgrades. Middleware insulates you from some of this but not completely.
We went with external middleware and haven’t regretted it. Our pricing engine is a separate microservice that handles all the complex logic - volume tiers, contract terms, approval workflows. Zendesk just stores the final quote results. This makes testing much easier since we can unit test pricing logic independently. The middleware approach also lets us reuse the same pricing engine across multiple systems, not just Zendesk.