Ecommerce Website Builder Module
Production-grade, multi-tenant online store module integrated with Biashara ERP inventory, POS, CRM, and Kenya payment rails.
Architecture
| Layer | Location |
|---|---|
| Config | config/ecommerce.php |
| Models | app/Models/Ecommerce/* |
| Services | app/Services/Ecommerce/* |
| Storefront | routes/ecommerce-storefront.php, resources/views/storefront/ |
| Tenant admin | routes/ecommerce-admin.php, /ecommerce/* |
| Platform admin | routes/platform.php → platform/ecommerce |
| Mobile/API | routes/ecommerce-api.php → /api/v1/ecommerce/* |
| Payments | Pluggable drivers in app/Services/Ecommerce/Payments/Drivers/ |
Subscription gating
- Module key:
ecommerce_website - Tier presets: enabled on
retail_growth,retail_professional,retail_enterprise - Middleware:
ecommerce.subscription,subscription.module:ecommerce_website - Route map:
config/subscription_route_modules.php(ecommerce,storeprefixes)
Inventory sync
EcommerceInventorySyncService reads BranchInventory (same as POS). Online availability = on-hand minus active cart reservations.
- Product observer auto-syncs listings when ERP products change
- Paid orders deduct branch stock; mirrored into
salesviaPlaceEcommerceSaleService - POS sales automatically reflect reduced online availability (shared stock rows)
Payments
| Provider | Driver | Channels |
|---|---|---|
| M-Pesa STK | MpesaStkPaymentDriver |
STK Push (reuses Daraja) |
| M-Pesa manual | MpesaManualPaymentDriver |
Till, Paybill |
| Stripe | StripePaymentDriver |
Card, Google Pay (intent) |
| PayPal | PayPalPaymentDriver |
PayPal |
| Card gateway | CardGatewayPaymentDriver |
Visa, Mastercard |
Webhooks: POST /webhooks/ecommerce/mpesa/{organization} → ProcessEcommerceWebhookJob
Themes (2026)
Configured in config/ecommerce.php — 13 industry presets (fashion, electronics, pharmacy, etc.).
Super admin
Platform → Ecommerce: global enable, approvals, commission, AI toggle, tenant store list, theme marketplace.
Tenant workflow
- Ensure tier includes
ecommerce_website - Open
/ecommerce→ Activate store - Sync products from ERP catalog
- Configure payments under
/ecommerce/payments - Build pages under
/ecommerce/builder - Storefront at
{tenant}.domain/store
Supermarket theme pack (supermarket-grid)
Full retail theme with:
- Promo bar, mega-menu categories, aisle grid, flash countdown, trust badges
- Theme CSS:
resources/css/themes/supermarket-grid.css - Views:
resources/views/storefront/themes/supermarket-grid/ - Auto-seeded home sections on activation or when switching theme in store settings
Set Theme → Supermarket Grid under /ecommerce/store, then open /store.
M-Pesa reconciliation
Tenant queue: /ecommerce/payments/reconciliation
- Query Daraja STK status (
DarajaStkQueryService) - Manual confirm with receipt code (reuses POS
PosManualMpesaVerifierrules) - Retry STK (max 3, configurable)
- Full audit trail in
ecommerce_payment_reconciliation_events
Visual builder (drag-and-drop)
/ecommerce/builder — block palette, HTML5 drag reorder, inline inspector, device preview widths.
Block catalog: config/ecommerce_builder.php
Future-ready hooks
ecommerce_analytics_eventsfor GA4 / Meta CAPI- API routes for Android/iOS apps
- AI features gated by
config/ecommerce.ai - GraphQL layer (add
routes/graphql.phpwhen needed)
Commands
php artisan migrate
php artisan test --filter=Ecommerce