Checkout flow for the ecommerce module.
apps/backend/src/domains/ecommerce/.apps/frontend/src/app/private/modules/ecommerce/.Checkout controller routes:
GET /ecommerce/checkout/payment-methods?shipping_type=... with JwtAuthGuard.POST /ecommerce/checkout with JwtAuthGuard.POST /ecommerce/checkout/prepare-wompi with JwtAuthGuard.POST /ecommerce/checkout/confirm-wompi-payment/:orderId with JwtAuthGuard.POST /ecommerce/checkout/whatsapp with @OptionalAuth().Cart routes are authenticated: GET /ecommerce/cart, POST /ecommerce/cart/items, PUT /ecommerce/cart/items/:id, DELETE /ecommerce/cart/items/:id, DELETE /ecommerce/cart, and POST /ecommerce/cart/sync.
CheckoutDto supports:
payment_method_id required.shipping_method_id, shipping_rate_id, shipping_address_id, or inline shipping_address.notes.items fallback for cart-less checkout payloads.bookings for bookable service products.WhatsappCheckoutDto supports notes, items, shipping_method_id, and shipping_rate_id.
The backend reads the authenticated user's ecommerce cart through EcommercePrismaService. If the backend cart is empty and DTO items exist, it uses those DTO items as fallback.
Current flow:
product_variant_id.StockValidatorService.PriceResolverService and taxes with TaxesService.channel: 'ecommerce' and state: 'pending_payment'.order.created.StockLevelManager.reserveStock(); checkout does not directly decrement stock.bookings are present; failures are logged and do not fail checkout.order_id, order_number, total, state, and message.GET /ecommerce/checkout/payment-methods filters enabled store payment methods by system_payment_method.processing_mode and shipping type:
pickup: DIRECT (cash/wallet at the store) + ONLINE. ON_DELIVERY is excluded because the customer is already at the store.own_fleet, carrier, custom, third_party_provider): all enabled modes — DIRECT + ONLINE + ON_DELIVERY. The customer can pay with cash, prepaid wallet, online gateway, or on delivery regardless of who delivers.Frontend reloads payment methods after shipping selection so the UI reflects the current context.
Why all modes for delivery: A delivery destination does not preclude paying with wallet balance (already prepaid) or with cash on arrival. Showing all configured methods gives the customer the full set of options their store enabled, which matches the expected UX.
Frontend normal checkout creates the order first, then prepares/opens Wompi.
Backend endpoints:
prepare-wompi builds widget config, reuses existing payments.gateway_reference when present, and validates redirect host against domain settings.confirm-wompi-payment/:orderId polls Wompi by transaction_id or gateway_reference, then applies the result through WebhookHandlerService.applyWompiTransaction.Frontend detects Wompi when selected method has type === 'wompi' or provider === 'wompi', opens the Wompi widget via shared WompiService, and confirms approved/declined/error callbacks as a UX fallback.
WhatsApp checkout is separate from normal checkout.
POST /ecommerce/checkout/whatsapp.items from localStorage cart.channel: 'whatsapp' and state: 'created'.Frontend files:
apps/frontend/src/app/private/modules/ecommerce/pages/checkout/checkout.component.tsapps/frontend/src/app/private/modules/ecommerce/services/checkout.service.tsapps/frontend/src/app/private/modules/ecommerce/services/cart.service.tsapps/frontend/src/app/private/modules/ecommerce/pages/cart/cart.component.tsThe normal /checkout route is protected by AuthGuard. Guest purchase is handled through WhatsApp checkout unless store config requires registration.
The checkout component uses signals/computed for core state and takeUntilDestroyed. Some shipping fields are still plain mutable fields in current code; avoid copying that pattern into new code.
Step selection is dynamic:
Shipping estimates are calculated by CartService.getShippingEstimates() through POST /shipping/calculate?store_id=..., not a checkout-owned endpoint.
/ecommerce/cart.vendix_cart./ecommerce/cart/sync, then localStorage is cleared.vendix-customer-auth - Customer login/register and guest boundaryvendix-payment-processors - Wompi and payment processor internalsvendix-inventory-stock - Reservation and stock validation behaviorvendix-multi-tenant-context - Ecommerce store/user contextvendix-zoneless-signals - Frontend signal state