Overview
The checkout validation endpoint ensures that the cart is ready for order processing. It performs comprehensive validation checks before allowing the user to proceed to payment.Validate Checkout
Validate the current cart and ensure all requirements are met for checkout.This endpoint requires user authentication via the
@auth_required decorator.Authentication
The request must include a valid authentication token in theAuthorization header:
Request
No request body is required. The endpoint validates the authenticated user’s current cart.Validation Checks
The endpoint performs the following validations:1. Stock Availability
Ensures all selected products are in stock (except JIT products or external API orders).Available stock must be greater than or equal to requested quantity
2. Quantity Limits
Validates that each product quantity does not exceed the maximum allowed.Maximum 10 units per product
3. Mystery Product Limits
For mystery products, ensures only one unit per parent product.4. Membership Requirements
Products in membership-only categories require an active membership or membership product in cart.Products with membership categories require:
- User has
is_exclusive= true, OR - Cart contains an exclusive membership product
5. Minimum Order Amount
Validates that the order meets the minimum required amount.Minimum order value (excluding certain exempted products)
- Exclusive upgrade products
- Products in
EXCLUDE_MIN_ORDER_AMOUNTlist - Users in
MIN_ORDER_EXEMPT_USER_IDSlist
6. Product Selection
Only validates products marked as selected in the cart.Products with
select: false are skipped during validation.Response
Success Response
Returns
true if all validations passError Responses
If validation fails, the endpoint returns a 400 Bad Request with a descriptive error message.Stock Validation Error
Quantity Limit Error
Membership Required Error
The exact error message for membership products is configured via
CART_VALIDATION_MEMBERSHIP_PRODUCT_ERROR_MSG.Mystery Product Error
Minimum Order Error
Validation Flow
Example Scenarios
Scenario 1: Valid Cart
Cart Contents:- Product A: qty 2, stock 10, price 500
- Product B: qty 1, stock 5, price 300
- Total: 1300 (above minimum)
Scenario 2: Out of Stock
Cart Contents:- Product A: qty 5, stock 3
Scenario 3: Quantity Exceeded
Cart Contents:- Product A: qty 15
Scenario 4: Below Minimum
Cart Contents:- Product A: qty 1, price 200
- Total: 200 (below 499 minimum)
Scenario 5: Membership Required
Cart Contents:- Member-only Product: qty 1
- User: not exclusive member
- No membership in cart
Scenario 6: Mystery Product Limit
Cart Contents:- Mystery Product A (parent: 1000): qty 1
- Mystery Product B (parent: 1000): qty 1
- Total mystery for parent 1000: 2
Integration Notes
Before Checkout
- User adds products to cart via Cart API
- User navigates to checkout page
- Call validate endpoint
- If validation passes, show payment options
- If validation fails, show error and redirect to cart
After Validation
Once validation passes, proceed with:- Address selection/entry
- Shipping method selection
- Payment method selection
- Order placement
Error Handling
Configuration Variables
The following settings control validation behavior:Minimum order value required (e.g., 499.0)
Product IDs that exempt the minimum order requirement
Product IDs exempt from minimum order validation
Category IDs that require membership
Custom error message for membership requirement
User IDs exempt from minimum order validation
Best Practices
Always validate before payment - Call this endpoint before showing payment options
Handle errors gracefully - Show clear error messages and guide users to fix issues
Real-time cart updates - Revalidate if cart is modified during checkout
Stock checking - This validation includes real-time stock checks
Related Endpoints
Cart Operations
Manage cart contents before checkout
Cart Overview
Understand cart structure and data