Documentation Index
Fetch the complete documentation index at: https://docs.khaime.com/llms.txt
Use this file to discover all available pages before exploring further.
Storefront + Cart Checkout
Use the storefront flow when customers need to browse products, build a basket, and pay for several items at once. Three components work together:<khaime-storefront>— product grid with filtering, currency switching, and an add-to-cart drawer.<khaime-cart-page>— optional standalone cart page (for a dedicated/cartroute).sdk.openCartCheckout()— opens the checkout modal with the current cart contents.
localStorage) and mirrored server-side in Redis with a 14-day TTL, so customers keep their basket across sessions and devices (as long as the UUID is on the same browser).
Only physical products can be added to the cart. Digital downloads, event tickets, and subscriptions use direct checkout — render them with a Pay Button instead.
Minimal setup
The full purchase flow
Customer lands on your page
<khaime-storefront> calls GET /api/v1/sdk/storefront/bootstrap (merchant branding, currencies, gateways) and GET /api/v1/sdk/storefront/products (the catalog).Customer adds items
Clicking “Add to cart” on a product card dispatches
khaime:add-to-cart. The SDK’s CartManager updates localStorage and syncs to the server via POST /api/v1/sdk/storefront/cart/items.Customer opens the cart
Depending on the
cart-display attribute, the drawer slides open or the page navigates to cartUrl. Cart contents are re-hydrated from GET /api/v1/sdk/storefront/cart/{cart_id}.Customer clicks Checkout
The SDK calls
sdk.openCartCheckout() internally (or you can call it yourself from a custom button). This opens the cart-checkout modal.Modal collects customer info + payment
The modal shows an email/name form, a shipping-address form (for physical goods), and then the Stripe Elements or Paystack UI based on the transaction currency.
Storefront configuration
| Attribute | Description |
|---|---|
product-ids | Comma-separated product IDs to restrict the grid to a specific set. |
category-slug | Filter by a ProductCategory slug (or comma-separated slugs). |
category-id | Filter by numeric ProductCategory.id. |
type | Filter by product type (physical, digital, service, etc.). |
sort | newest, price_asc, price_desc, etc. |
columns | Grid columns (1–6). |
limit | Products per page. |
cart-display | drawer (default), page, or both. See below. |
cart-url | Destination when cart-display is page or both. Defaults to /cart. |
Cart display modes
drawer— Cart opens as a slide-out overlay on the current page. Best for single-page experiences.page— “View cart” links navigate tocart-url. Pair with a dedicated<khaime-cart-page>on that route.both— Drawer opens for quick reviews, but the “Checkout” CTA routes tocart-urlas a pre-checkout review step.
Standalone cart page
For a dedicated cart route, render<khaime-cart-page> on /cart:
Programmatic cart access
The SDK exposesCartManager so you can read or mutate the cart from your own UI:
Events you’ll want to handle
Next steps
- Programmatic checkout — create sessions on your server.
- Events reference — complete list of purchase events.
- Webhooks — verify orders server-side before fulfilment.
