Sandbox vs Production Services - Feature Differences
This document outlines the key differences between sandbox and production environments for the commerce microservice API.
Overview
The commerce microservice provides two distinct environments:
- Sandbox: Testing environment with mock data and simulated responses
- Production: Live environment with real integrations and actual business data
The environment is automatically selected based on your API configuration and endpoint usage.
Environment Selection
Services are automatically configured based on your environment settings. No code changes are required to switch between environments.
1. Transaction Processing
Production Environment
- Real Gateway Integration: Processes actual transactions through external payment systems
- Live Validation: Performs real-time validation of stores, clients, and business rules
- Actual Transaction IDs: Generates unique transaction identifiers from live systems
- Real Status Updates: Transaction statuses reflect actual payment processing states
- External Dependencies: Requires connectivity to external payment gateways
Sandbox Environment
- Mock Transactions: Simulates transaction processing without real money movement
- Predictable Results: Same inputs always produce the same outputs for testing
- Sequential Transaction Numbers: Generates predictable, incrementing transaction IDs
- Controlled Error Testing: Use specific patterns in your requests to trigger different error scenarios
- No External Dependencies: Works independently without external service connectivity
Error Testing in Sandbox:
- Include "REJECTED" in external reference fields to simulate transaction failures
- Use specific folio patterns to test different transaction statuses
2. Client Management
Production Environment
- Live Customer Data: Fetches real customer information from your business systems
- Dynamic Credit Lines: Returns current, real-time credit availability
- Real-time Validation: Validates customer status and purchasing capability
- Live Search Results: Customer searches return actual business data
- Network Dependencies: Requires connectivity to customer management systems
Sandbox Environment
- Predefined Test Customers: Provides three consistent test customer profiles
- Fixed Credit Lines: Predictable credit amounts for testing scenarios
- Deterministic Search: Same search terms always return the same customers
- Instant Responses: No network delays or external system dependencies
Test Customer Profiles:
- Standard Customer: Normal purchasing capability with good credit
- New Customer: First-time buyer with limited credit history
- Restricted Customer: Customer with purchasing limitations for testing denial scenarios
3. Sale Link Generation
Production Environment
- Real JWT Tokens: Generates secure tokens for actual payment processing
- Live Store Validation: Validates stores and salespeople exist in your business systems
- Actual Expiration: Links expire based on real business rules and timing
- Database Integration: Stores and retrieves actual sale request data
Sandbox Environment
- Test Tokens: Generates valid tokens for testing purposes
- Mock Validation: Simulates store and salesperson validation
- Predictable Expiration: Uses the same expiration rules but with test data
- Isolated Data: Uses separate test data that doesn't affect production
Key Difference:
- Production validates against both "FINISHED" and "APPROVED" statuses
- Sandbox only checks "FINISHED" status for simplified testing
4. Sale Request Processing
Production Environment
- Live Client Integration: Searches and validates customers in real business systems
- Actual Transaction Creation: Creates real transactions that affect business operations
- Real Status Tracking: Transaction statuses reflect actual payment processing
- Live Callback URLs: Triggers real webhook notifications to your systems
Sandbox Environment
- Mock Client Search: Uses predefined test customers for consistent testing
- Simulated Transactions: Creates test transactions without business impact
- Fixed Status Updates: Uses predictable status changes for testing
- Test Callbacks: Simulates webhook notifications without triggering live systems
5. Store and Salesperson Data
Production Environment
- Live Business Data: Returns actual stores and salespeople from your business systems
- Dynamic Lists: Store and salesperson lists reflect current business operations
- Real Relationships: Validates actual store-salesperson relationships
- Current Status: Returns only active stores and salespeople
Sandbox Environment
- Empty Test Results: Currently returns empty lists for consistent testing
- Predictable Responses: Same requests always return the same results
- Testing Focus: Designed for testing API structure rather than data content
- No Business Impact: Test queries don't affect live business data
6. Webhook Processing
Production Environment
- Live Webhook Delivery: Sends actual HTTP requests to your configured endpoints
- Real Integration: Triggers real business processes and system integrations
- Actual Customer Data: Webhook payloads contain real customer and transaction information
- Live Error Handling: Real network issues and endpoint failures
Sandbox Environment
- Simulated Webhooks: Mimics webhook sending without actual HTTP requests
- Test Data Payloads: Uses predefined test data in webhook simulations
- Safe Testing: Prevents accidental triggering of live business processes
- Controlled Testing: Predictable webhook behavior for testing scenarios
Testing Strategy
When to Use Sandbox
- Development and Testing: Build and test your integration safely
- Automated Testing: Run consistent tests with predictable results
- Demo Environments: Showcase functionality without affecting live data
- Error Scenario Testing: Test how your system handles various error conditions
- Integration Validation: Verify API integration before going live
When to Use Production
- Live Operations: Process real customer transactions
- End-to-End Testing: Validate complete workflows with real data
- Performance Testing: Test with actual data volumes and network conditions
- Business Operations: Handle actual customer requests and transactions
Data Consistency
Sandbox Benefits
- Predictable Results: Same API calls always return the same data
- Controlled Testing: Test specific scenarios with known data sets
- Fast Development: No network delays or external dependencies
- Safe Experimentation: Experiment without affecting live systems
- Error Simulation: Test error handling with controlled error scenarios
Production Benefits
- Real Data Validation: Ensure your integration works with actual business data
- Live Performance: Test under real-world conditions and data volumes
- Actual Integration: Validate complete end-to-end business processes
- Business Validation: Ensure functionality meets actual business requirements
Environment Configuration
Automatic Selection
- Environments are automatically selected based on your API configuration
- No manual switching required between sandbox and production
- Consistent API endpoints and request/response formats
- Same authentication and authorization mechanisms
Key Differences in Behavior
- Response Times: Sandbox responses are faster (no external calls)
- Data Freshness: Production has real-time data, sandbox has static test data
- Error Scenarios: Sandbox allows controlled error testing
- Business Impact: Only production affects actual business operations
Best Practices
Development Workflow
- Start with Sandbox: Develop and test your integration in sandbox first
- Test Error Scenarios: Use sandbox to test how your system handles errors
- Validate Data Handling: Ensure your system properly processes API responses
- Performance Testing: Test with production for real-world performance validation
- Go Live Gradually: Start with limited production testing before full deployment
Testing Recommendations
- Use sandbox for all automated testing and CI/CD pipelines
- Test error scenarios thoroughly in sandbox before production
- Validate production integration with small test transactions
- Monitor production carefully during initial deployment
- Keep sandbox tests updated as your integration evolves
This dual-environment approach ensures you can develop and test safely while maintaining reliable production operations.